X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/665de339e5c1afde21d836ce4be9abe94ae483e0..feb458f8dd4c897f3aa688943d75dbf58bc090f5:/lib/Geocode.php diff --git a/lib/Geocode.php b/lib/Geocode.php index a01abbc5..9249b314 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -1,5 +1,6 @@ aLangPrefOrder = $aLangPref; } - function setIncludeAddressDetails($bAddressDetails = true) - { - $this->bIncludeAddressDetails = (bool)$bAddressDetails; - } - function getIncludeAddressDetails() { return $this->bIncludeAddressDetails; @@ -87,21 +83,11 @@ $this->bIncludePolygonAsPoints = $b; } - function getIncludePolygonAsPoints() - { - return $this->bIncludePolygonAsPoints; - } - function setIncludePolygonAsText($b = true) { $this->bIncludePolygonAsText = $b; } - function getIncludePolygonAsText() - { - return $this->bIncludePolygonAsText; - } - function setIncludePolygonAsGeoJSON($b = true) { $this->bIncludePolygonAsGeoJSON = $b; @@ -122,11 +108,6 @@ $this->fPolygonSimplificationThreshold = $f; } - function setDeDupe($bDeDupe = true) - { - $this->bDeDupe = (bool)$bDeDupe; - } - function setLimit($iLimit = 10) { if ($iLimit > 50) $iLimit = 50; @@ -136,32 +117,11 @@ $this->iLimit = $this->iFinalLimit + min($this->iFinalLimit, 10); } - function setOffset($iOffset = 0) - { - $this->iOffset = $iOffset; - } - - function setFallback($bFallback = true) - { - $this->bFallback = (bool)$bFallback; - } - - function setExcludedPlaceIDs($a) - { - // TODO: force to int - $this->aExcludePlaceIDs = $a; - } - function getExcludedPlaceIDs() { return $this->aExcludePlaceIDs; } - function setBounded($bBoundedSearch = true) - { - $this->bBoundedSearch = (bool)$bBoundedSearch; - } - function setViewBox($fLeft, $fBottom, $fRight, $fTop) { $this->aViewBox = array($fLeft, $fBottom, $fRight, $fTop); @@ -173,11 +133,6 @@ return $this->aViewBox[0].','.$this->aViewBox[3].','.$this->aViewBox[2].','.$this->aViewBox[1]; } - function setRoute($aRoutePoints) - { - $this->aRoutePoints = $aRoutePoints; - } - function setFeatureType($sFeatureType) { switch($sFeatureType) @@ -199,8 +154,8 @@ function setRankRange($iMin, $iMax) { - $this->iMinAddressRank = (int)$iMin; - $this->iMaxAddressRank = (int)$iMax; + $this->iMinAddressRank = $iMin; + $this->iMaxAddressRank = $iMax; } function setNearPoint($aNearPoint, $fRadiusDeg = 0.1) @@ -208,11 +163,6 @@ $this->aNearPoint = array((float)$aNearPoint[0], (float)$aNearPoint[1], (float)$fRadiusDeg); } - function setCountryCodesList($aCountryCodes) - { - $this->aCountryCodes = $aCountryCodes; - } - function setQuery($sQueryString) { $this->sQuery = $sQueryString; @@ -1696,9 +1646,17 @@ else { // Just interpret as a reverse geocode - $iPlaceID = geocodeReverse((float)$this->aNearPoint[0], (float)$this->aNearPoint[1]); - if ($iPlaceID) - $aSearchResults = $this->getDetails(array($iPlaceID)); + $oReverse = new ReverseGeocode($this->oDB); + $oReverse->setZoom(18); + + $aLookup = $oReverse->lookup((float)$this->aNearPoint[0], + (float)$this->aNearPoint[1], + false); + + if (CONST_Debug) var_dump("Reverse search", $aLookup); + + if ($aLookup['place_id']) + $aSearchResults = $this->getDetails(array($aLookup['place_id'] => -1)); else $aSearchResults = array(); } @@ -1726,19 +1684,19 @@ if (CONST_Debug) { echo 'Recheck words:<\i>'; var_dump($aRecheckWords); } + $oPlaceLookup = new PlaceLookup($this->oDB); + $oPlaceLookup->setIncludePolygonAsPoints($this->bIncludePolygonAsPoints); + $oPlaceLookup->setIncludePolygonAsText($this->bIncludePolygonAsText); + $oPlaceLookup->setIncludePolygonAsGeoJSON($this->bIncludePolygonAsGeoJSON); + $oPlaceLookup->setIncludePolygonAsKML($this->bIncludePolygonAsKML); + $oPlaceLookup->setIncludePolygonAsSVG($this->bIncludePolygonAsSVG); + $oPlaceLookup->setPolygonSimplificationThreshold($this->fPolygonSimplificationThreshold); + foreach($aSearchResults as $iResNum => $aResult) { // Default $fDiameter = getResultDiameter($aResult); - $oPlaceLookup = new PlaceLookup($this->oDB); - $oPlaceLookup->setIncludePolygonAsPoints($this->bIncludePolygonAsPoints); - $oPlaceLookup->setIncludePolygonAsText($this->bIncludePolygonAsText); - $oPlaceLookup->setIncludePolygonAsGeoJSON($this->bIncludePolygonAsGeoJSON); - $oPlaceLookup->setIncludePolygonAsKML($this->bIncludePolygonAsKML); - $oPlaceLookup->setIncludePolygonAsSVG($this->bIncludePolygonAsSVG); - $oPlaceLookup->setPolygonSimplificationThreshold($this->fPolygonSimplificationThreshold); - $aOutlineResult = $oPlaceLookup->getOutlines($aResult['place_id'], $aResult['lon'], $aResult['lat'], $fDiameter/2); if ($aOutlineResult) {