13 => 18,
14 => 22, // Suburb
15 => 22,
- 16 => 26, // Street, TODO: major street?
- 17 => 26,
+ 16 => 26, // major street
+ 17 => 27, // minor street
18 => 30, // or >, Building
19 => 30, // or >, Building
);
$sSQL .= ' and indexed_status = 0 and startnumber is not NULL ';
$sSQL .= ' ORDER BY distance ASC limit 1';
- return chksql(
- $this->oDB->getRow($sSQL),
+ return $this->oDB->getRow(
+ $sSQL,
+ null,
'Could not determine closest housenumber on an osm interpolation line.'
);
}
$sSQL = 'SELECT country_code FROM country_osm_grid';
$sSQL .= ' WHERE ST_CONTAINS(geometry, '.$sPointSQL.') LIMIT 1';
- $sCountryCode = chksql(
- $this->oDB->getOne($sSQL),
+ $sCountryCode = $this->oDB->getOne(
+ $sSQL,
+ null,
'Could not determine country polygon containing the point.'
);
if ($sCountryCode) {
$sSQL .= ' LIMIT 1';
if (CONST_Debug) var_dump($sSQL);
- $aPlace = chksql(
- $this->oDB->getRow($sSQL),
- 'Could not determine place node.'
- );
+ $aPlace = $this->oDB->getRow($sSQL, null, 'Could not determine place node.');
if ($aPlace) {
return new Result($aPlace['place_id']);
}
$sSQL .= ' ORDER BY distance ASC';
if (CONST_Debug) var_dump($sSQL);
- $aPlace = chksql(
- $this->oDB->getRow($sSQL),
- 'Could not determine place node.'
- );
+ $aPlace = $this->oDB->getRow($sSQL, null, 'Could not determine place node.');
if ($aPlace) {
return new Result($aPlace['place_id']);
}
$sSQL .= ' WHERE ST_CONTAINS(geometry, '.$sPointSQL.' )';
$sSQL .= ' ORDER BY rank_address DESC LIMIT 1';
- $aPoly = chksql(
- $this->oDB->getRow($sSQL),
- 'Could not determine polygon containing the point.'
- );
+ $aPoly = $this->oDB->getRow($sSQL, null, 'Could not determine polygon containing the point.');
+
if ($aPoly) {
// if a polygon is found, search for placenodes begins ...
$iParentPlaceID = $aPoly['parent_place_id'];
$sSQL .= ' LIMIT 1';
if (CONST_Debug) var_dump($sSQL);
- $aPlacNode = chksql(
- $this->oDB->getRow($sSQL),
- 'Could not determine place node.'
- );
+ $aPlacNode = $this->oDB->getRow($sSQL, null, 'Could not determine place node.');
if ($aPlacNode) {
return $aPlacNode;
}
$sSQL .= ' placex';
$sSQL .= ' WHERE ST_DWithin('.$sPointSQL.', geometry, '.$fSearchDiam.')';
$sSQL .= ' AND';
- // only streets
- if ($iMaxRank == 26) {
- $sSQL .= ' rank_address = 26';
- } else {
- $sSQL .= ' rank_address between 26 and '.$iMaxRank;
- }
+ $sSQL .= ' rank_address between 26 and '.$iMaxRank;
$sSQL .= ' and (name is not null or housenumber is not null';
$sSQL .= ' or rank_address between 26 and 27)';
$sSQL .= ' and (rank_address between 26 and 27';
$sSQL .= ' OR ST_DWithin('.$sPointSQL.', centroid, '.$fSearchDiam.'))';
$sSQL .= ' ORDER BY distance ASC limit 1';
if (CONST_Debug) var_dump($sSQL);
- $aPlace = chksql(
- $this->oDB->getRow($sSQL),
- 'Could not determine closest place.'
- );
+ $aPlace = $this->oDB->getRow($sSQL, null, 'Could not determine closest place.');
if (CONST_Debug) var_dump($aPlace);
if ($aPlace) {
// radius ?
$sSQL .= ' WHERE ST_DWithin('.$sPointSQL.', geometry, 0.001)';
$sSQL .= ' AND parent_place_id = '.$iPlaceID;
- $sSQL .= ' and rank_address != 28';
+ $sSQL .= ' and rank_address > 28';
$sSQL .= ' and ST_GeometryType(geometry) != \'ST_LineString\'';
$sSQL .= ' and (name is not null or housenumber is not null)';
$sSQL .= ' and class not in (\'boundary\')';
$sSQL .= ' and indexed_status = 0 and linked_place_id is null';
$sSQL .= ' ORDER BY distance ASC limit 1';
if (CONST_Debug) var_dump($sSQL);
- $aStreet = chksql(
- $this->oDB->getRow($sSQL),
- 'Could not determine closest place.'
- );
+ $aStreet = $this->oDB->getRow($sSQL, null, 'Could not determine closest place.');
if ($aStreet) {
if (CONST_Debug) var_dump($aStreet);
$oResult = new Result($aStreet['place_id']);
$sSQL .= ' AND ST_DWithin('.$sPointSQL.', linegeo, 0.001)';
$sSQL .= ' ORDER BY distance ASC limit 1';
if (CONST_Debug) var_dump($sSQL);
- $aPlaceTiger = chksql(
- $this->oDB->getRow($sSQL),
- 'Could not determine closest Tiger place.'
- );
+ $aPlaceTiger = $this->oDB->getRow($sSQL, null, 'Could not determine closest Tiger place.');
if ($aPlaceTiger) {
if (CONST_Debug) var_dump('found Tiger housenumber', $aPlaceTiger);
$oResult = new Result($aPlaceTiger['place_id'], Result::TABLE_TIGER);