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/PlaceLookup.php
+25
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,8 @@ class PlaceLookup
5
5
6
6
protected$iPlaceID;
7
7
8
+
protected$bIsTiger = false;
9
+
8
10
protected$aLangPrefOrder = array();
9
11
10
12
protected$bAddressDetails = false;
@@ -35,6 +37,11 @@ function setOSMID($sType, $iID)
35
37
$this->iPlaceID = $this->oDB->getOne($sSQL);
36
38
}
37
39
40
+
functionsetIsTiger($b = false)
41
+
{
42
+
$this->bIsTiger = $b;
43
+
}
44
+
38
45
functionlookup()
39
46
{
40
47
if (!$this->iPlaceID) returnnull;
@@ -49,12 +56,29 @@ function lookup()
49
56
$sSQL .= " (case when centroid is null then st_y(st_centroid(geometry)) else st_y(centroid) end) as lat,";
50
57
$sSQL .= " (case when centroid is null then st_x(st_centroid(geometry)) else st_x(centroid) end) as lon";
51
58
$sSQL .= " from placex where place_id = ".(int)$this->iPlaceID;
59
+
60
+
61
+
if ($this->bIsTiger)
62
+
{
63
+
$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,";
64
+
$sSQL .= " 'us' as country_code, null as extratags, parent_place_id, null as linked_place_id, 30 as rank_address, 30 as rank_search,";
65
+
$sSQL .= " coalesce(0,0.75-(30::float/40)) as importance, null as indexed_status, null as indexed_date, null as wikipedia, 'us' as calculated_country_code, ";
66
+
$sSQL .= " get_address_by_language(place_id, $sLanguagePrefArraySQL) as langaddress,";
67
+
$sSQL .= " null as placename,";
68
+
$sSQL .= " null as ref,";
69
+
$sSQL .= " st_y(centroid) as lat,";
70
+
$sSQL .= " st_x(centroid) as lon";
71
+
$sSQL .= " from location_property_tiger where place_id = ".(int)$this->iPlaceID;
72
+
}
73
+
52
74
$aPlace = $this->oDB->getRow($sSQL);
53
75
76
+
54
77
if (PEAR::IsError($aPlace))
55
78
{
56
79
failInternalError("Could not lookup place.", $sSQL, $aPlace);
0 commit comments