You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: lib/Geocode.php
+62-53
Original file line number
Diff line number
Diff line change
@@ -431,56 +431,62 @@ function getDetails($aPlaceIDs)
431
431
432
432
if (30 >= $this->iMinAddressRank && 30 <= $this->iMaxAddressRank)
433
433
{
434
-
//query also location_property_tiger and location_property_aux
435
-
//Tiger search only if a housenumber was searched and if it was found (i.e. aPlaceIDs[placeID] = housenumber != -1) (realized through a join)
436
-
//only Tiger housenumbers need to be interpolated, because they are saved as lines with start- and endnumber, the common osm housenumbers are usually saved as points
//query also location_property_tiger and location_property_aux
437
+
//Tiger search only if a housenumber was searched and if it was found (i.e. aPlaceIDs[placeID] = housenumber != -1) (realized through a join)
438
+
//only Tiger housenumbers need to be interpolated, because they are saved as lines with start- and endnumber, the common osm housenumbers are usually saved as points
$sSQL .= "select 'T' as osm_type, place_id as osm_id, 'place' as class, 'house' as type, null as admin_level, 30 as rank_search, 30 as rank_address, min(place_id) as place_id, min(parent_place_id) as parent_place_id, 'us' as country_code";
452
+
$sSQL .= ", get_address_by_language(place_id, housenumber_for_place, $sLanguagePrefArraySQL) as langaddress ";
453
+
$sSQL .= ", null as placename";
454
+
$sSQL .= ", null as ref";
455
+
if ($this->bIncludeExtraTags) $sSQL .= ", null as extra";
456
+
if ($this->bIncludeNameDetails) $sSQL .= ", null as names";
457
+
$sSQL .= ", avg(st_x(centroid)) as lon, avg(st_y(centroid)) as lat,";
458
+
$sSQL .= $sImportanceSQL."-1.15 as importance ";
459
+
$sSQL .= ", (select max(p.importance*(p.rank_address+2)) from place_addressline s, placex p where s.place_id = min(blub.parent_place_id) and p.place_id = s.address_place_id and s.isaddress and p.importance is not null) as addressimportance ";
460
+
$sSQL .= ", null as extra_place ";
461
+
$sSQL .= " from (select place_id";
462
+
//interpolate the Tiger housenumbers here
463
+
$sSQL .= ", ST_LineInterpolatePoint(linegeo, (housenumber_for_place-startnumber::float)/(endnumber-startnumber)::float) as centroid, parent_place_id, housenumber_for_place ";
$sSQL .= " where housenumber_for_place>=0 and 30 between $this->iMinAddressRank and $this->iMaxAddressRank) as blub"; //postgres wants an alias here
467
+
$sSQL .= " group by place_id, housenumber_for_place"; //is this group by really needed?, place_id + housenumber (in combination) are unique
468
+
if (!$this->bDeDupe) $sSQL .= ", place_id ";
446
469
}
447
470
448
-
$sSQL .= "union ";
449
-
$sSQL .= "select 'T' as osm_type, place_id as osm_id, 'place' as class, 'house' as type, null as admin_level, 30 as rank_search, 30 as rank_address, min(place_id) as place_id, min(parent_place_id) as parent_place_id, 'us' as country_code";
450
-
$sSQL .= ", get_address_by_language(place_id, housenumber_for_place, $sLanguagePrefArraySQL) as langaddress ";
451
-
$sSQL .= ", null as placename";
452
-
$sSQL .= ", null as ref";
453
-
if ($this->bIncludeExtraTags) $sSQL .= ", null as extra";
454
-
if ($this->bIncludeNameDetails) $sSQL .= ", null as names";
455
-
$sSQL .= ", avg(st_x(centroid)) as lon, avg(st_y(centroid)) as lat,";
456
-
$sSQL .= $sImportanceSQL."-1.15 as importance ";
457
-
$sSQL .= ", (select max(p.importance*(p.rank_address+2)) from place_addressline s, placex p where s.place_id = min(blub.parent_place_id) and p.place_id = s.address_place_id and s.isaddress and p.importance is not null) as addressimportance ";
458
-
$sSQL .= ", null as extra_place ";
459
-
$sSQL .= " from (select place_id";
460
-
//interpolate the Tiger housenumbers here
461
-
$sSQL .= ", ST_LineInterpolatePoint(linegeo, (housenumber_for_place-startnumber::float)/(endnumber-startnumber)::float) as centroid, parent_place_id, housenumber_for_place ";
$sSQL .= " where housenumber_for_place>=0 and 30 between $this->iMinAddressRank and $this->iMaxAddressRank) as blub"; //postgres wants an alias here
465
-
$sSQL .= " group by place_id, housenumber_for_place"; //is this group by really needed?, place_id + housenumber (in combination) are unique
466
-
if (!$this->bDeDupe) $sSQL .= ", place_id ";
467
-
468
-
$sSQL .= " union ";
469
-
$sSQL .= "select 'L' as osm_type, place_id as osm_id, 'place' as class, 'house' as type, null as admin_level, 0 as rank_search, 0 as rank_address, min(place_id) as place_id, min(parent_place_id) as parent_place_id, 'us' as country_code, ";
470
-
$sSQL .= "get_address_by_language(place_id, -1, $sLanguagePrefArraySQL) as langaddress, ";
471
-
$sSQL .= "null as placename, ";
472
-
$sSQL .= "null as ref, ";
473
-
if ($this->bIncludeExtraTags) $sSQL .= "null as extra, ";
474
-
if ($this->bIncludeNameDetails) $sSQL .= "null as names, ";
475
-
$sSQL .= "avg(ST_X(centroid)) as lon, avg(ST_Y(centroid)) as lat, ";
476
-
$sSQL .= $sImportanceSQL."-1.10 as importance, ";
477
-
$sSQL .= "(select max(p.importance*(p.rank_address+2)) from place_addressline s, placex p where s.place_id = min(location_property_aux.parent_place_id) and p.place_id = s.address_place_id and s.isaddress and p.importance is not null) as addressimportance, ";
478
-
$sSQL .= "null as extra_place ";
479
-
$sSQL .= "from location_property_aux where place_id in ($sPlaceIDs) ";
480
-
$sSQL .= "and 30 between $this->iMinAddressRank and $this->iMaxAddressRank";
$sSQL .= "select 'L' as osm_type, place_id as osm_id, 'place' as class, 'house' as type, null as admin_level, 0 as rank_search, 0 as rank_address, min(place_id) as place_id, min(parent_place_id) as parent_place_id, 'us' as country_code, ";
475
+
$sSQL .= "get_address_by_language(place_id, -1, $sLanguagePrefArraySQL) as langaddress, ";
476
+
$sSQL .= "null as placename, ";
477
+
$sSQL .= "null as ref, ";
478
+
if ($this->bIncludeExtraTags) $sSQL .= "null as extra, ";
479
+
if ($this->bIncludeNameDetails) $sSQL .= "null as names, ";
480
+
$sSQL .= "avg(ST_X(centroid)) as lon, avg(ST_Y(centroid)) as lat, ";
481
+
$sSQL .= $sImportanceSQL."-1.10 as importance, ";
482
+
$sSQL .= "(select max(p.importance*(p.rank_address+2)) from place_addressline s, placex p where s.place_id = min(location_property_aux.parent_place_id) and p.place_id = s.address_place_id and s.isaddress and p.importance is not null) as addressimportance, ";
483
+
$sSQL .= "null as extra_place ";
484
+
$sSQL .= "from location_property_aux where place_id in ($sPlaceIDs) ";
485
+
$sSQL .= "and 30 between $this->iMinAddressRank and $this->iMaxAddressRank";
if (CONST_Use_Aux_Location_data && !sizeof($aPlaceIDs))
1435
1441
{
1436
1442
$sSQL = "select place_id from location_property_aux where parent_place_id in (".$sPlaceIDs.") and housenumber = '".pg_escape_string($aSearch['sHouseNumber'])."'";
1437
1443
if (sizeof($this->aExcludePlaceIDs))
@@ -1444,7 +1450,7 @@ function lookup()
1444
1450
}
1445
1451
//if nothing was found in placex or location_property_aux, then search in Tiger data for this housenumber(location_property_tiger)
if (CONST_Use_US_Tiger_Data && $this->sType == 'tiger')
126
126
{
127
127
$sSQL = "select place_id,partition, 'T' as osm_type, place_id as osm_id, 'place' as class, 'house' as type, null as admin_level, housenumber, null as street, null as isin, postcode,";
128
128
$sSQL .= " 'us' as country_code, parent_place_id, null as linked_place_id, 30 as rank_address, 30 as rank_search,";
@@ -166,7 +166,7 @@ function lookup()
166
166
167
167
if ($this->bAddressDetails)
168
168
{
169
-
if($this->sType == 'tiger') // to get addressdetails for tiger data, the housenumber is needed
169
+
if(CONST_Use_US_Tiger_Data && $this->sType == 'tiger') // to get addressdetails for tiger data, the housenumber is needed
0 commit comments