From 16794a84defe0839c17f97b14c57b1bac23be4b2 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 24 Feb 2019 11:00:33 +0100 Subject: [PATCH] Change accepted features for reverse geocoding at rank 30 Always exclude line features (removes railways, tunnels, piers, historical streets etc.) and boundaries (removes electoral, historical boundaries etc.) Fixes #1313. --- lib/ReverseGeocode.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ReverseGeocode.php b/lib/ReverseGeocode.php index 820ca385..9601ecf5 100644 --- a/lib/ReverseGeocode.php +++ b/lib/ReverseGeocode.php @@ -263,7 +263,9 @@ class ReverseGeocode } $sSQL .= ' and (name is not null or housenumber is not null'; $sSQL .= ' or rank_address between 26 and 27)'; - $sSQL .= ' and class not in (\'railway\',\'tunnel\',\'bridge\',\'man_made\')'; + $sSQL .= ' and (rank_address between 26 and 27'; + $sSQL .= ' or ST_GeometryType(geometry) != \'ST_LineString\')'; + $sSQL .= ' and class not in (\'boundary\')'; $sSQL .= ' and indexed_status = 0 and linked_place_id is null'; $sSQL .= ' and (ST_GeometryType(geometry) not in (\'ST_Polygon\',\'ST_MultiPolygon\') '; $sSQL .= ' OR ST_DWithin('.$sPointSQL.', centroid, '.$fSearchDiam.'))'; @@ -315,8 +317,9 @@ class ReverseGeocode $sSQL .= ' WHERE ST_DWithin('.$sPointSQL.', geometry, 0.001)'; $sSQL .= ' AND parent_place_id = '.$iPlaceID; $sSQL .= ' and rank_address != 28'; + $sSQL .= ' and ST_GeometryType(geometry) != \'ST_LineString\''; $sSQL .= ' and (name is not null or housenumber is not null)'; - $sSQL .= ' and class not in (\'railway\',\'tunnel\',\'bridge\',\'man_made\')'; + $sSQL .= ' and class not in (\'boundary\')'; $sSQL .= ' and indexed_status = 0 and linked_place_id is null'; $sSQL .= ' ORDER BY distance ASC limit 1'; if (CONST_Debug) var_dump($sSQL); -- 2.39.5