]> git.openstreetmap.org Git - nominatim.git/commitdiff
fixed getoutlinesfunction
authorgemo1011 <moritzgeiger91@web.de>
Wed, 20 Jun 2018 09:35:51 +0000 (11:35 +0200)
committergemo1011 <moritzgeiger91@web.de>
Wed, 27 Jun 2018 12:55:15 +0000 (14:55 +0200)
lib/PlaceLookup.php
lib/ReverseGeocode.php

index ade073e5ac9f52a65972e9bed86ca225c1d8fbbb..44161a7e6048c50e008a245f58f38df6bb53be20 100644 (file)
@@ -557,10 +557,10 @@ class PlaceLookup
             if ($this->bIncludePolygonAsText || $this->bIncludePolygonAsPoints) $sSQL .= ',ST_AsText(geometry) as astext';
             if ($fLonReverse != null && $fLatReverse != null) {
                 $sFrom = ' from (SELECT * , ST_ClosestPoint(geometry, ST_SetSRID(ST_Point('.$fLatReverse.','.$fLonReverse.'),4326)) AS closest_point';
+                $sFrom .= ' from placex where place_id = '.$iPlaceID.') as plx';
             } else {
                 $sFrom = ' from placex where place_id = '.$iPlaceID;
             }
-            $sFrom .= ' from placex where place_id = '.$iPlaceID.') as plx';
             if ($this->fPolygonSimplificationThreshold > 0) {
                 $sSQL .= ' from (select place_id,centroid,ST_SimplifyPreserveTopology(geometry,'.$this->fPolygonSimplificationThreshold.') as geometry'.$sFrom.') as plx';
             } else {
index 44ab2bdf8473841172135642e9e7a6b636377ed7..91a043da702137cd3d71d41715d3755815d90b77 100644 (file)
@@ -127,10 +127,6 @@ class ReverseGeocode
     
     protected function lookupPolygon($sPointSQL, $iMaxRank)
     {
-    
-        $oResult = null;
-        $aPlace = null;
-        
         $sSQL = 'SELECT * FROM';
         $sSQL .= '(select place_id,parent_place_id,rank_address, rank_search, country_code, geometry';
         $sSQL .= ' FROM placex';
@@ -253,6 +249,9 @@ class ReverseGeocode
                 $iParentPlaceID = $aPlace['parent_place_id'];
                 
                 if ($bDoInterpolation && $iMaxRank >= 30) {
+                    if ($aPlace['rank_address'] <=27) {
+                        $iDistance = 0.001;
+                    }
                     $aHouse = $this->lookupInterpolation($sPointSQL, $iDistance);
 
                     if ($aHouse) {
@@ -282,7 +281,7 @@ class ReverseGeocode
                         'Could not determine closest place.'
                     );
                     if ($aStreet) {
-                        $iDistance = $aPlace['distance'];
+                        $iDistance = $aStreet['distance'];
                         $iPlaceID = $aStreet['place_id'];
                         $oResult = new Result($iPlaceID);
                         $iParentPlaceID = $aStreet['parent_place_id'];