]> git.openstreetmap.org Git - nominatim.git/commitdiff
added case when for highways in subquery
authorgemo1011 <moritzgeiger91@web.de>
Thu, 21 Jun 2018 12:33:22 +0000 (14:33 +0200)
committergemo1011 <moritzgeiger91@web.de>
Wed, 27 Jun 2018 12:55:18 +0000 (14:55 +0200)
lib/PlaceLookup.php

index 44161a7e6048c50e008a245f58f38df6bb53be20..270e2745f03a110142271dce8f3f3a6a95aa9049 100644 (file)
@@ -556,7 +556,8 @@ class PlaceLookup
             if ($this->bIncludePolygonAsSVG) $sSQL .= ',ST_AsSVG(geometry) as assvg';
             if ($this->bIncludePolygonAsText || $this->bIncludePolygonAsPoints) $sSQL .= ',ST_AsText(geometry) as astext';
             if ($fLonReverse != null && $fLatReverse != null) {
             if ($this->bIncludePolygonAsSVG) $sSQL .= ',ST_AsSVG(geometry) as assvg';
             if ($this->bIncludePolygonAsText || $this->bIncludePolygonAsPoints) $sSQL .= ',ST_AsText(geometry) as astext';
             if ($fLonReverse != null && $fLatReverse != null) {
-                $sFrom = ' from (SELECT * , ST_ClosestPoint(geometry, ST_SetSRID(ST_Point('.$fLatReverse.','.$fLonReverse.'),4326)) AS closest_point';
+                $sFrom = ' from (SELECT * , CASE WHEN (class = \'highway\') AND (ST_GeometryType(geometry) = \'ST_LineString\') THEN ';
+                $sFrom .=' ST_ClosestPoint(geometry, ST_SetSRID(ST_Point('.$fLatReverse.','.$fLonReverse.'),4326)) END AS closest_point';
                 $sFrom .= ' from placex where place_id = '.$iPlaceID.') as plx';
             } else {
                 $sFrom = ' from placex where place_id = '.$iPlaceID;
                 $sFrom .= ' from placex where place_id = '.$iPlaceID.') as plx';
             } else {
                 $sFrom = ' from placex where place_id = '.$iPlaceID;