mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-15 15:34:07 +00:00
adapted the coding style with phpcs
This commit is contained in:
@@ -74,8 +74,8 @@ class ReverseGeocode
|
|||||||
$sSQL = 'SELECT * FROM';
|
$sSQL = 'SELECT * FROM';
|
||||||
$sSQL .= '(select place_id,parent_place_id,rank_address,country_code, geometry';
|
$sSQL .= '(select place_id,parent_place_id,rank_address,country_code, geometry';
|
||||||
$sSQL .= ' FROM placex';
|
$sSQL .= ' FROM placex';
|
||||||
$sSQL .= ' WHERE ST_GeometryType(geometry) in (\'ST_Polygon\',\'ST_MultiPolygon\')';
|
$sSQL .= ' WHERE ST_GeometryType(geometry) in (\'ST_Polygon\', \'ST_MultiPolygon\')';
|
||||||
$sSQL .= ' AND rank_address <= '.Min(25,$iMaxRank);
|
$sSQL .= ' AND rank_address <= ' .Min(25, $iMaxRank);
|
||||||
$sSQL .= ' AND geometry && '.$sPointSQL;
|
$sSQL .= ' AND geometry && '.$sPointSQL;
|
||||||
$sSQL .= ' AND type != \'postcode\' ';
|
$sSQL .= ' AND type != \'postcode\' ';
|
||||||
$sSQL .= ' AND name is not null';
|
$sSQL .= ' AND name is not null';
|
||||||
@@ -102,7 +102,7 @@ class ReverseGeocode
|
|||||||
$sSQL .= ' FROM placex';
|
$sSQL .= ' FROM placex';
|
||||||
$sSQL .= ' WHERE osm_type = \'N\'';
|
$sSQL .= ' WHERE osm_type = \'N\'';
|
||||||
$sSQL .= ' AND rank_address > '.$iRankAddress;
|
$sSQL .= ' AND rank_address > '.$iRankAddress;
|
||||||
$sSQL .= ' AND rank_address <= '.Min(25,$iMaxRank);
|
$sSQL .= ' AND rank_address <= ' .Min(25, $iMaxRank);
|
||||||
$sSQL .= ' AND type != \'postcode\'';
|
$sSQL .= ' AND type != \'postcode\'';
|
||||||
$sSQL .= ' AND name IS NOT NULL ';
|
$sSQL .= ' AND name IS NOT NULL ';
|
||||||
$sSQL .= ' and class not in (\'waterway\',\'railway\',\'tunnel\',\'bridge\',\'man_made\')';
|
$sSQL .= ' and class not in (\'waterway\',\'railway\',\'tunnel\',\'bridge\',\'man_made\')';
|
||||||
@@ -150,8 +150,7 @@ class ReverseGeocode
|
|||||||
$bIsTigerStreet = false;
|
$bIsTigerStreet = false;
|
||||||
|
|
||||||
// for POI or street level
|
// for POI or street level
|
||||||
if ( $iMaxRank >= 26 ) {
|
if ($iMaxRank >= 26) {
|
||||||
|
|
||||||
$sSQL = 'select place_id,parent_place_id,rank_address,country_code,';
|
$sSQL = 'select place_id,parent_place_id,rank_address,country_code,';
|
||||||
$sSQL .= 'CASE WHEN ST_GeometryType(geometry) in (\'ST_Polygon\',\'ST_MultiPolygon\') THEN ST_distance('.$sPointSQL.', centroid)';
|
$sSQL .= 'CASE WHEN ST_GeometryType(geometry) in (\'ST_Polygon\',\'ST_MultiPolygon\') THEN ST_distance('.$sPointSQL.', centroid)';
|
||||||
$sSQL .= ' ELSE ST_distance('.$sPointSQL.', geometry) ';
|
$sSQL .= ' ELSE ST_distance('.$sPointSQL.', geometry) ';
|
||||||
@@ -185,7 +184,7 @@ class ReverseGeocode
|
|||||||
$oResult = new Result($iPlaceID);
|
$oResult = new Result($iPlaceID);
|
||||||
$iParentPlaceID = $aPlace['parent_place_id'];
|
$iParentPlaceID = $aPlace['parent_place_id'];
|
||||||
// if street and maxrank > streetlevel
|
// if street and maxrank > streetlevel
|
||||||
if (($aPlace['rank_address'] == 26 || $aPlace['rank_address'] == 27)&& $iMaxRank > 27 ) {
|
if (($aPlace['rank_address'] == 26 || $aPlace['rank_address'] == 27)&& $iMaxRank > 27) {
|
||||||
// find the closest object (up to a certain radius) of which the street is a parent of
|
// find the closest object (up to a certain radius) of which the street is a parent of
|
||||||
$sSQL = ' select place_id,parent_place_id,rank_address,country_code,';
|
$sSQL = ' select place_id,parent_place_id,rank_address,country_code,';
|
||||||
$sSQL .= ' ST_distance('.$sPointSQL.', geometry) as distance';
|
$sSQL .= ' ST_distance('.$sPointSQL.', geometry) as distance';
|
||||||
@@ -211,14 +210,14 @@ class ReverseGeocode
|
|||||||
$iParentPlaceID = $aStreet['parent_place_id'];
|
$iParentPlaceID = $aStreet['parent_place_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$aPlace = $this->lookupPolygon($sPointSQL, $iMaxRank);
|
$aPlace = $this->lookupPolygon($sPointSQL, $iMaxRank);
|
||||||
if ($aPlace) {
|
if ($aPlace) {
|
||||||
$oResult = new Result($aPlace['place_id']);
|
$oResult = new Result($aPlace['place_id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// lower than street level ($iMaxRank < 26 )
|
// lower than street level ($iMaxRank < 26 )
|
||||||
}else{
|
} else {
|
||||||
$aPlace = $this->lookupPolygon($sPointSQL, $iMaxRank);
|
$aPlace = $this->lookupPolygon($sPointSQL, $iMaxRank);
|
||||||
if ($aPlace) {
|
if ($aPlace) {
|
||||||
$oResult = new Result($aPlace['place_id']);
|
$oResult = new Result($aPlace['place_id']);
|
||||||
@@ -226,5 +225,4 @@ class ReverseGeocode
|
|||||||
}
|
}
|
||||||
return $oResult;
|
return $oResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user