cleanup of SQL for readability. No logic change

This commit is contained in:
marc tobias
2016-10-30 13:57:48 +01:00
committed by Sarah Hoffmann
parent 4f3074e538
commit eb79e655e6
3 changed files with 27 additions and 2 deletions

View File

@@ -532,7 +532,7 @@ class Geocode
$sSQL .= " UNION "; $sSQL .= " UNION ";
$sSQL .= "SELECT "; $sSQL .= "SELECT ";
$sSQL .= " 'W' AS osm_type, "; $sSQL .= " 'W' AS osm_type, ";
$sSQL .= " place_id AS osm_id, "; $sSQL .= " osm_id, ";
$sSQL .= " 'place' AS class, "; $sSQL .= " 'place' AS class, ";
$sSQL .= " 'house' AS type, "; $sSQL .= " 'house' AS type, ";
$sSQL .= " null AS admin_level, "; $sSQL .= " null AS admin_level, ";
@@ -563,6 +563,7 @@ class Geocode
$sSQL .= " null AS extra_place "; $sSQL .= " null AS extra_place ";
$sSQL .= " FROM ("; $sSQL .= " FROM (";
$sSQL .= " SELECT "; $sSQL .= " SELECT ";
$sSQL .= " osm_id, ";
$sSQL .= " place_id, "; $sSQL .= " place_id, ";
$sSQL .= " calculated_country_code, "; $sSQL .= " calculated_country_code, ";
$sSQL .= " CASE "; // interpolate the housenumbers here $sSQL .= " CASE "; // interpolate the housenumbers here

View File

@@ -207,7 +207,6 @@ Feature: Import of address interpolations
| startnumber | endnumber | geometry | startnumber | endnumber | geometry
| 2 | 6 | 0 0, 0 0.001 | 2 | 6 | 0 0, 0 0.001
Scenario: addr:street on interpolation way Scenario: addr:street on interpolation way
Given the scene parallel-road Given the scene parallel-road
And the place nodes And the place nodes
@@ -239,6 +238,18 @@ Feature: Import of address interpolations
| object | parent_place_id | startnumber | endnumber | object | parent_place_id | startnumber | endnumber
| W10 | W2 | 2 | 6 | W10 | W2 | 2 | 6
| W11 | W3 | 12 | 16 | 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 Scenario: addr:street on housenumber way
Given the scene parallel-road Given the scene parallel-road
@@ -271,6 +282,14 @@ Feature: Import of address interpolations
| object | parent_place_id | startnumber | endnumber | object | parent_place_id | startnumber | endnumber
| W10 | W2 | 2 | 6 | W10 | W2 | 2 | 6
| W11 | W3 | 12 | 16 | 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) Scenario: Geometry of points and way don't match (github #253)
Given the place nodes Given the place nodes

View File

@@ -69,6 +69,11 @@ if (CONST_Use_US_Tiger_Data) {
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID; 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) { if (CONST_Use_Aux_Location_data) {
$iParentPlaceID = chksql($oDB->getOne('SELECT parent_place_id FROM location_property_aux WHERE place_id = '.$iPlaceID)); $iParentPlaceID = chksql($oDB->getOne('SELECT parent_place_id FROM location_property_aux WHERE place_id = '.$iPlaceID));
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID; if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;