]> git.openstreetmap.org Git - nominatim.git/commitdiff
cleanup of SQL for readability. No logic change
authormarc tobias <mtmail@gmx.net>
Sun, 30 Oct 2016 12:57:48 +0000 (13:57 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 1 Nov 2016 22:33:47 +0000 (23:33 +0100)
lib/Geocode.php
tests/features/db/import/interpolation.feature
website/details.php

index c234c5f2d7a3b9414a8a91b85671488c8fe9ec55..a8e4083b2c4883238e9d55cf7de0026c23619a17 100644 (file)
@@ -532,7 +532,7 @@ class Geocode
             $sSQL .= " UNION ";
             $sSQL .= "SELECT ";
             $sSQL .= "  'W' AS osm_type, ";
-            $sSQL .= "  place_id AS osm_id, ";
+            $sSQL .= "  osm_id, ";
             $sSQL .= "  'place' AS class, ";
             $sSQL .= "  'house' AS type, ";
             $sSQL .= "  null AS admin_level, ";
@@ -563,6 +563,7 @@ class Geocode
             $sSQL .= "  null AS extra_place ";
             $sSQL .= "  FROM (";
             $sSQL .= "     SELECT ";
+            $sSQL .= "         osm_id, ";
             $sSQL .= "         place_id, ";
             $sSQL .= "         calculated_country_code, ";
             $sSQL .= "         CASE ";             // interpolate the housenumbers here
index 1c05a882eb62564c317ae2b6ab436e52c296f9fc..6974e7bec70599e928a51330ae59d25e637e7a89 100644 (file)
@@ -207,7 +207,6 @@ Feature: Import of address interpolations
           | startnumber | endnumber | geometry
           | 2           | 6         | 0 0, 0 0.001
 
-
     Scenario: addr:street on interpolation way
         Given the scene parallel-road
         And the place nodes
@@ -239,6 +238,18 @@ Feature: Import of address interpolations
           | object | parent_place_id | startnumber | endnumber
           | W10    | W2              | 2           | 6
           | W11    | W3              | 12          | 16
+        When sending query "16 Cloud Street"
+        Then results contain
+         | ID | osm_type | osm_id
+         | 0  | N        | 4
+        When sending query "14 Cloud Street"
+        Then results contain
+         | ID | osm_type | osm_id
+         | 0  | W        | 11
+        When sending query "18 Cloud Street"
+        Then results contain
+         | ID | osm_type | osm_id
+         | 0  | W        | 3
 
     Scenario: addr:street on housenumber way
         Given the scene parallel-road
@@ -271,6 +282,14 @@ Feature: Import of address interpolations
           | object | parent_place_id | startnumber | endnumber
           | W10    | W2              | 2           | 6
           | W11    | W3              | 12          | 16
+        When sending query "16 Cloud Street"
+        Then results contain
+         | ID | osm_type | osm_id
+         | 0  | N        | 4
+        When sending query "14 Cloud Street"
+        Then results contain
+         | ID | osm_type | osm_id
+         | 0  | W        | 11
 
     Scenario: Geometry of points and way don't match (github #253)
         Given the place nodes
index 0b21123dd2f83c97ec234ed01d73eea34f97b92d..0dc3397aa42e6864ef89e6325253eaa53472b34a 100755 (executable)
@@ -69,6 +69,11 @@ if (CONST_Use_US_Tiger_Data) {
     if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
 }
 
+// interpolated house numbers
+$iParentPlaceID = chksql($oDB->getOne('SELECT parent_place_id FROM location_property_osmline WHERE place_id = '.$iPlaceID));
+if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
+
+
 if (CONST_Use_Aux_Location_data) {
     $iParentPlaceID = chksql($oDB->getOne('SELECT parent_place_id FROM location_property_aux WHERE place_id = '.$iPlaceID));
     if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;