From 62b60c70e6eb6b5752df621bf07ef016eb7d994a Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 13 Aug 2018 21:17:49 +0200 Subject: [PATCH] reverse on street level should compute distance to object The centroid of a building may be far away even when still inside the building. Fixes #1136. --- lib/ReverseGeocode.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/ReverseGeocode.php b/lib/ReverseGeocode.php index 60f35449..0500df93 100644 --- a/lib/ReverseGeocode.php +++ b/lib/ReverseGeocode.php @@ -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.')'; -- 2.39.5