X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/9240e83802b30c940ceec9ac51700b86b77b65e2..9e54d1d6eb3e418c13ea090eeee4c9f9ee30b55a:/lib/ReverseGeocode.php diff --git a/lib/ReverseGeocode.php b/lib/ReverseGeocode.php index 6d3cc829..d4e13875 100644 --- a/lib/ReverseGeocode.php +++ b/lib/ReverseGeocode.php @@ -57,7 +57,7 @@ class ReverseGeocode $sSQL .= ' , ST_Distance(linegeo,'.$sPointSQL.') as distance'; $sSQL .= ' FROM location_property_osmline'; $sSQL .= ' WHERE ST_DWithin('.$sPointSQL.', linegeo, '.$fSearchDiam.')'; - $sSQL .= ' and indexed_status = 0 '; + $sSQL .= ' and indexed_status = 0 and startnumber is not NULL '; $sSQL .= ' ORDER BY ST_distance('.$sPointSQL.', linegeo) ASC limit 1'; return chksql( @@ -153,7 +153,7 @@ class ReverseGeocode // look for an interpolation that is closer $aPlaceLine = $this->lookupInterpolation($sPointSQL, $fDistancePlacex); - if ($aPlaceLine) { + if ($aPlaceLine && (float) $aPlaceLine['distance'] < (float) $fDistancePlacex) { // interpolation is closer to point than placex house $bPlaceIsLine = true; $aPlace = $aPlaceLine; @@ -201,6 +201,8 @@ class ReverseGeocode if ($iPlaceID && $iMaxRank < 28) { if (($aPlace['rank_search'] > 28 || $bPlaceIsTiger || $bPlaceIsLine) && $iParentPlaceID) { $iPlaceID = $iParentPlaceID; + $bPlaceIsLine = false; + $bPlaceIsTiger = false; } $sSQL = 'select address_place_id'; $sSQL .= ' FROM place_addressline';