]> git.openstreetmap.org Git - nominatim.git/commitdiff
reverse on street level should compute distance to object
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 13 Aug 2018 19:17:49 +0000 (21:17 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 13 Aug 2018 19:17:49 +0000 (21:17 +0200)
The centroid of a building may be far away even when still inside
the building.

Fixes #1136.

lib/ReverseGeocode.php

index 60f3544916c09a4ee7b755f4da7244c873bdc175..0500df937c2431ea3a2abc2cd15106044b5ea0d9 100644 (file)
@@ -247,9 +247,7 @@ class ReverseGeocode
         // for POI or street level
         if ($iMaxRank >= 26) {
             $sSQL = 'select place_id,parent_place_id,rank_address,country_code,';
-            $sSQL .= 'CASE WHEN ST_GeometryType(geometry) in (\'ST_Polygon\',\'ST_MultiPolygon\') THEN ST_distance('.$sPointSQL.', centroid)';
-            $sSQL .= ' ELSE ST_distance('.$sPointSQL.', geometry) ';
-            $sSQL .= ' END as distance';
+            $sSQL .= ' ST_distance('.$sPointSQL.', geometry) as distance';
             $sSQL .= ' FROM ';
             $sSQL .= ' placex';
             $sSQL .= '   WHERE ST_DWithin('.$sPointSQL.', geometry, '.$fSearchDiam.')';