<?php
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
+ require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
class Geocode
{
}
}
}
+ // If a coordinate is given, the search must either
+ // be for a name or a special search. Ignore everythin else.
+ else if ($aSearch['fLon'] && !sizeof($aSearch['aName']) && !sizeof($aSearch['aAddress']) && !$aSearch['sClass'])
+ {
+ $aPlaceIDs = array();
+ }
else
{
$aPlaceIDs = array();
else
{
// Just interpret as a reverse geocode
- $iPlaceID = geocodeReverse((float)$this->aNearPoint[0], (float)$this->aNearPoint[1]);
- if ($iPlaceID)
- $aSearchResults = $this->getDetails(array($iPlaceID));
+ $oReverse = new ReverseGeocode($this->oDB);
+ $oReverse->setLatLon((float)$this->aNearPoint[0], (float)$this->aNearPoint[1]);
+ $oReverse->setZoom(18);
+
+ $aLookup = $oReverse->lookup(false);
+
+ if (CONST_Debug) var_dump("Reverse search", $aLookup);
+
+ if ($aLookup['place_id'])
+ $aSearchResults = $this->getDetails(array($aLookup['place_id'] => -1));
else
$aSearchResults = array();
}