Skip to content

Commit

Permalink
Return normalized name for toponyms
Browse files Browse the repository at this point in the history
  • Loading branch information
jjrom committed May 3, 2016
1 parent eb67bdd commit a015e96
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/iTag/Taggers/Tagger_Toponyms.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,13 @@ private function process($footprint, $options) {
$codes = "('PPL', 'PPLC', 'PPLA', 'PPLA2', 'PPLA3', 'PPLA4', 'STLMT')";

$prequery = 'WITH prequery AS (SELECT ' . $this->postgisGeomFromText($footprint) . ' AS corrected_geometry, ST_centroid(' . $this->postgisGeomFromText($footprint) . ') AS corrected_centroid)';
$query = $prequery . ' SELECT geonameid, name, country, countryname, longitude, latitude, fcode, population, ST_Distance(geom, corrected_centroid) as distance FROM prequery, gazetteer.geoname WHERE st_intersects(geom, corrected_geometry) AND fcode IN ' . $codes . ' ORDER BY distance ASC';
$query = $prequery . ' SELECT geonameid, name, normalize(name) as normalized, country, countryname, longitude, latitude, fcode, population, ST_Distance(geom, corrected_centroid) as distance FROM prequery, gazetteer.geoname WHERE st_intersects(geom, corrected_geometry) AND fcode IN ' . $codes . ' ORDER BY distance ASC';
$results = $this->query($query);
while ($result = pg_fetch_assoc($results)) {
$toponyms[] = array(
'id' => (integer) $result['geonameid'],
'name' => $result['name'],
'normalized' => $result['normalized'],
'country' => $result['countryname'],
'ccode' => $result['country'],
'geo:lon' => (float) $result['longitude'],
Expand Down

0 comments on commit a015e96

Please sign in to comment.