public function lookupOSMID($sType, $iID)
{
- $sSQL = "select place_id from placex where osm_type = '".$sType."' and osm_id = ".$iID;
- $iPlaceID = chksql($this->oDB->getOne($sSQL));
+ $sSQL = 'select place_id from placex where osm_type = :type and osm_id = :id';
+ $iPlaceID = $this->oDB->getOne($sSQL, array(':type' => $sType, ':id' => $iID));
if (!$iPlaceID) {
return null;
'ST_Collect(centroid)',
'min(CASE WHEN placex.rank_search < 28 THEN placex.place_id ELSE placex.parent_place_id END)'
);
- $sSQL .= " (extratags->'place') AS extra_place ";
+ $sSQL .= " COALESCE(extratags->'place', extratags->'linked_place') AS extra_place ";
$sSQL .= ' FROM placex';
$sSQL .= " WHERE place_id in ($sPlaceIDs) ";
$sSQL .= ' AND (';
$sSQL .= ' ref, ';
if ($this->bExtraTags) $sSQL .= 'extratags, ';
if ($this->bNameDetails) $sSQL .= 'name, ';
- $sSQL .= " extratags->'place' ";
+ $sSQL .= ' extra_place ';
$aSubSelects[] = $sSQL;
}
$sSQL = join(' UNION ', $aSubSelects);
Debug::printSQL($sSQL);
- $aPlaces = chksql($this->oDB->getAll($sSQL), 'Could not lookup place');
+ $aPlaces = $this->oDB->getAll($sSQL, null, 'Could not lookup place');
foreach ($aPlaces as &$aPlace) {
+ $aPlace['importance'] = (float) $aPlace['importance'];
if ($this->bAddressDetails) {
// to get addressdetails for tiger data, the housenumber is needed
$aPlace['address'] = new AddressDetails(
$sSQL .= $sFrom;
}
- $aPointPolygon = chksql($this->oDB->getRow($sSQL), 'Could not get outline');
+ $aPointPolygon = $this->oDB->getRow($sSQL, null, 'Could not get outline');
if ($aPointPolygon && $aPointPolygon['place_id']) {
if ($aPointPolygon['centrelon'] !== null && $aPointPolygon['centrelat'] !== null) {