X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/4b28b4fed469ef5826e61633f82b93a29e1c9b3f..6b89624f339dbf36bd668d83b3d0b12edc62f616:/lib-php/ReverseGeocode.php diff --git a/lib-php/ReverseGeocode.php b/lib-php/ReverseGeocode.php index 5a852889..cccd5b35 100644 --- a/lib-php/ReverseGeocode.php +++ b/lib-php/ReverseGeocode.php @@ -64,8 +64,8 @@ class ReverseGeocode { Debug::newFunction('lookupInterpolation'); $sSQL = 'SELECT place_id, parent_place_id, 30 as rank_search,'; - $sSQL .= ' ST_LineLocatePoint(linegeo,'.$sPointSQL.') as fraction,'; - $sSQL .= ' startnumber, endnumber, interpolationtype,'; + $sSQL .= ' (endnumber - startnumber) * ST_LineLocatePoint(linegeo,'.$sPointSQL.') as fhnr,'; + $sSQL .= ' startnumber, endnumber, step,'; $sSQL .= ' ST_Distance(linegeo,'.$sPointSQL.') as distance'; $sSQL .= ' FROM location_property_osmline'; $sSQL .= ' WHERE ST_DWithin('.$sPointSQL.', linegeo, '.$fSearchDiam.')'; @@ -363,7 +363,11 @@ class ReverseGeocode if ($aHouse) { $oResult = new Result($aHouse['place_id'], Result::TABLE_OSMLINE); - $oResult->iHouseNumber = closestHouseNumber($aHouse); + $iRndNum = max(0, round($aHouse['fhnr'] / $aHouse['step']) * $aHouse['step']); + $oResult->iHouseNumber = $aHouse['startnumber'] + $iRndNum; + if ($oResult->iHouseNumber > $aHouse['endnumber']) { + $oResult->iHouseNumber = $aHouse['endnumber']; + } $aPlace = $aHouse; } }