X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/64abc90d3072bbfbc9aae316f5ef709b8782532e..821dabb138b78be6fd776ab047b024d319805012:/lib-php/ReverseGeocode.php diff --git a/lib-php/ReverseGeocode.php b/lib-php/ReverseGeocode.php index 646c592b..35103aeb 100644 --- a/lib-php/ReverseGeocode.php +++ b/lib-php/ReverseGeocode.php @@ -64,7 +64,9 @@ class ReverseGeocode { Debug::newFunction('lookupInterpolation'); $sSQL = 'SELECT place_id, parent_place_id, 30 as rank_search,'; - $sSQL .= ' (endnumber - startnumber) * ST_LineLocatePoint(linegeo,'.$sPointSQL.') as fhnr,'; + $sSQL .= ' (CASE WHEN endnumber != startnumber'; + $sSQL .= ' THEN (endnumber - startnumber) * ST_LineLocatePoint(linegeo,'.$sPointSQL.')'; + $sSQL .= ' ELSE startnumber END) as fhnr,'; $sSQL .= ' startnumber, endnumber, step,'; $sSQL .= ' ST_Distance(linegeo,'.$sPointSQL.') as distance'; $sSQL .= ' FROM location_property_osmline';