X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/8c444378bcc542413eaa5789e21995e33c96a751..01b009ff24494408b8b568bcc0f6c4ad4156b9ce:/lib/PlaceLookup.php?ds=sidebyside diff --git a/lib/PlaceLookup.php b/lib/PlaceLookup.php index 1a76389a..eebfe983 100644 --- a/lib/PlaceLookup.php +++ b/lib/PlaceLookup.php @@ -15,7 +15,6 @@ class PlaceLookup protected $bExtraTags = false; protected $bNameDetails = false; - protected $bIncludePolygonAsPoints = false; protected $bIncludePolygonAsText = false; protected $bIncludePolygonAsGeoJSON = false; protected $bIncludePolygonAsKML = false; @@ -38,11 +37,6 @@ class PlaceLookup return $this->bDeDupe; } - public function setIncludePolygonAsPoints($b = true) - { - $this->bIncludePolygonAsPoints = $b; - } - public function setIncludeAddressDetails($b) { $this->bAddressDetails = $b; @@ -61,7 +55,6 @@ class PlaceLookup if ($sGeomType === null || $sGeomType == 'geojson') { $this->bIncludePolygonAsGeoJSON = $oParams->getBool('polygon_geojson'); - $this->bIncludePolygonAsPoints = false; } if ($oParams->getString('format', '') !== 'geojson') { @@ -100,7 +93,6 @@ class PlaceLookup if ($this->bExtraTags) $aParams['extratags'] = '1'; if ($this->bNameDetails) $aParams['namedetails'] = '1'; - if ($this->bIncludePolygonAsPoints) $aParams['polygon'] = '1'; if ($this->bIncludePolygonAsText) $aParams['polygon_text'] = '1'; if ($this->bIncludePolygonAsGeoJSON) $aParams['polygon_geojson'] = '1'; if ($this->bIncludePolygonAsKML) $aParams['polygon_kml'] = '1'; @@ -248,7 +240,7 @@ class PlaceLookup $sSQL .= ' ref, '; if ($this->bExtraTags) $sSQL .= 'extratags, '; if ($this->bNameDetails) $sSQL .= 'name, '; - $sSQL .= " extra_place "; + $sSQL .= ' extra_place '; $aSubSelects[] = $sSQL; } @@ -456,10 +448,9 @@ class PlaceLookup } } - $aPlace['addresstype'] = ClassTypes\getProperty( + $aPlace['addresstype'] = ClassTypes\getLabelTag( $aPlace, - 'simplelabel', - $aPlace['class'] + $aPlace['country_code'] ); } @@ -500,7 +491,7 @@ class PlaceLookup if ($this->bIncludePolygonAsGeoJSON) $sSQL .= ',ST_AsGeoJSON(geometry) as asgeojson'; if ($this->bIncludePolygonAsKML) $sSQL .= ',ST_AsKML(geometry) as askml'; if ($this->bIncludePolygonAsSVG) $sSQL .= ',ST_AsSVG(geometry) as assvg'; - if ($this->bIncludePolygonAsText || $this->bIncludePolygonAsPoints) $sSQL .= ',ST_AsText(geometry) as astext'; + if ($this->bIncludePolygonAsText) $sSQL .= ',ST_AsText(geometry) as astext'; if ($fLonReverse != null && $fLatReverse != null) { $sFrom = ' from (SELECT * , CASE WHEN (class = \'highway\') AND (ST_GeometryType(geometry) = \'ST_LineString\') THEN '; $sFrom .=' ST_ClosestPoint(geometry, ST_SetSRID(ST_Point('.$fLatReverse.','.$fLonReverse.'),4326))'; @@ -527,8 +518,6 @@ class PlaceLookup if ($this->bIncludePolygonAsKML) $aOutlineResult['askml'] = $aPointPolygon['askml']; if ($this->bIncludePolygonAsSVG) $aOutlineResult['assvg'] = $aPointPolygon['assvg']; if ($this->bIncludePolygonAsText) $aOutlineResult['astext'] = $aPointPolygon['astext']; - if ($this->bIncludePolygonAsPoints) $aOutlineResult['aPolyPoints'] = geometryText2Points($aPointPolygon['astext'], $fRadius); - if (abs($aPointPolygon['minlat'] - $aPointPolygon['maxlat']) < 0.0000001) { $aPointPolygon['minlat'] = $aPointPolygon['minlat'] - $fRadius; @@ -551,17 +540,12 @@ class PlaceLookup // as a fallback we generate a bounding box without knowing the size of the geometry if ((!isset($aOutlineResult['aBoundingBox'])) && isset($fLon)) { - // - if ($this->bIncludePolygonAsPoints) { - $sGeometryText = 'POINT('.$fLon.','.$fLat.')'; - $aOutlineResult['aPolyPoints'] = geometryText2Points($sGeometryText, $fRadius); - } - - $aBounds = array(); - $aBounds['minlat'] = $fLat - $fRadius; - $aBounds['maxlat'] = $fLat + $fRadius; - $aBounds['minlon'] = $fLon - $fRadius; - $aBounds['maxlon'] = $fLon + $fRadius; + $aBounds = array( + 'minlat' => $fLat - $fRadius, + 'maxlat' => $fLat + $fRadius, + 'minlon' => $fLon - $fRadius, + 'maxlon' => $fLon + $fRadius + ); $aOutlineResult['aBoundingBox'] = array( (string)$aBounds['minlat'],