- // List of excluded Place IDs - used for more acurate pageing
- if (isset($_GET['exclude_place_ids']) && $_GET['exclude_place_ids'])
- {
- foreach(explode(',',$_GET['exclude_place_ids']) as $iExcludedPlaceID)
- {
- $iExcludedPlaceID = (int)$iExcludedPlaceID;
- if ($iExcludedPlaceID) $aExcludePlaceIDs[$iExcludedPlaceID] = $iExcludedPlaceID;
- }
- $oGeocode->setExcludedPlaceIds($aExcludePlaceIDs);
- }
-
- // Only certain ranks of feature
- if (isset($_GET['featureType'])) $oGeocode->setFeatureType($_GET['featureType']);
- if (isset($_GET['featuretype'])) $oGeocode->setFeatureType($_GET['featuretype']);
-
- // Country code list
- if (isset($_GET['countrycodes']))
- {
- $aCountryCodes = array();
- foreach(explode(',',$_GET['countrycodes']) as $sCountryCode)
- {
- if (preg_match('/^[a-zA-Z][a-zA-Z]$/', $sCountryCode))
- {
- $aCountryCodes[] = strtolower($sCountryCode);
- }
- }
- $oGeocode->setCountryCodeList($aCountryCodes);
- }
-
- if (isset($_GET['viewboxlbrt']) && $_GET['viewboxlbrt'])
- {
- $aCoOrdinatesLBRT = explode(',',$_GET['viewboxlbrt']);
- $oGeocode->setViewBox($aCoOrdinatesLBRT[0], $aCoOrdinatesLBRT[1], $aCoOrdinatesLBRT[2], $aCoOrdinatesLBRT[3]);
- }
-
- if (isset($_GET['viewbox']) && $_GET['viewbox'])
- {
- $aCoOrdinatesLTRB = explode(',',$_GET['viewbox']);
- $oGeocode->setViewBox($aCoOrdinatesLTRB[0], $aCoOrdinatesLTRB[3], $aCoOrdinatesLTRB[2], $aCoOrdinatesLTRB[1]);
- }
-
- if (isset($_GET['route']) && $_GET['route'] && isset($_GET['routewidth']) && $_GET['routewidth'])
- {
- $aPoints = explode(',',$_GET['route']);
- if (sizeof($aPoints) % 2 != 0)
- {
- userError("Uneven number of points");
- exit;
- }
- $fPrevCoord = false;
- $aRoute = array();
- foreach($aPoints as $i => $fPoint)
- {
- if ($i%2)
- {
- $aRoute[] = array((float)$fPoint, $fPrevCoord);
- }
- else
- {
- $fPrevCoord = (float)$fPoint;
- }
- }
- $oGeocode->setRoute($aRoute);
- }
-
- // Search query
- $sQuery = (isset($_GET['q'])?trim($_GET['q']):'');
- if (!$sQuery && isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
- {
- $sQuery = substr($_SERVER['PATH_INFO'], 1);