]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/ReverseGeocode.php
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / lib-php / ReverseGeocode.php
index 646c592b9f5d4b3dc5efba035406602f0b44d3bc..35103aeb3f78681e93fc5e3aa0c287fb498739df 100644 (file)
@@ -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';