X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/2a784fa3d4533d11e3227f868085dcee5a9870c6..4a321487f3d44241242a1729ab4d137df1f57bfb:/lib/ReverseGeocode.php diff --git a/lib/ReverseGeocode.php b/lib/ReverseGeocode.php index 509ec0a8..41eed262 100644 --- a/lib/ReverseGeocode.php +++ b/lib/ReverseGeocode.php @@ -5,11 +5,13 @@ class ReverseGeocode protected $oDB; protected $iMaxRank = 28; + function ReverseGeocode(&$oDB) { $this->oDB =& $oDB; } + function setZoom($iZoom) { // Zoom to rank, this could probably be calculated but a lookup gives fine control @@ -38,8 +40,13 @@ class ReverseGeocode $this->iMaxRank = (isset($iZoom) && isset($aZoomRank[$iZoom]))?$aZoomRank[$iZoom]:28; } - // returns { place_id =>, type => '(osm|tiger)' } - // fails if no place was found + + /* lookup() + * returns { place_id =>, type => '(osm|tiger)' } + * fails if no place was found + */ + + function lookup($fLat, $fLon, $bDoInterpolation = true) { $sPointSQL = 'ST_SetSRID(ST_Point('.$fLon.','.$fLat.'),4326)'; @@ -111,7 +118,7 @@ class ReverseGeocode if ($aPlaceLine) { if (CONST_Debug) var_dump('found housenumber in interpolation lines table', $aPlaceLine); if ($aPlace['rank_search'] == 30) { - // if a house was already found in placex, we have to find out, + // if a house was already found in placex, we have to find out, // if the placex house or the interpolated house are closer to the searched point // distance between point and placex house $sSQL = 'SELECT ST_distance('.$sPointSQL.', house.geometry) as distance FROM placex as house WHERE house.place_id='.$iPlaceID; @@ -204,5 +211,4 @@ class ReverseGeocode 'fraction' => ($bPlaceIsTiger || $bPlaceIsLine) ? $fFraction : -1 ); } - }