- if ($bShowAddressDetails)
- {
- $aAddress = getAddressDetails($oDB, $sLanguagePrefArraySQL, $iPlaceID, $aPlace['country_code']);
- }
- $aClassType = getClassTypes();
- $sAddressType = '';
- $sClassType = $aPlace['class'].':'.$aPlace['type'].':'.$aPlace['admin_level'];
- if (isset($aClassType[$sClassType]) && isset($aClassType[$sClassType]['simplelabel']))
- {
- $sAddressType = $aClassType[$aClassType]['simplelabel'];
- }
- else
+ $hLog = logStart($oDB, 'reverse', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
+
+
+ if (isset($_GET['osm_type']) && isset($_GET['osm_id']) && (int)$_GET['osm_id'] && ($_GET['osm_type'] == 'N' || $_GET['osm_type'] == 'W' || $_GET['osm_type'] == 'R'))
+ {
+ $aLookup = array('osm_type' => $_GET['osm_type'], 'osm_id' => $_GET['osm_id']);
+ }
+ else if (isset($_GET['lat']) && isset($_GET['lon']) && preg_match('/^[+-]?[0-9]*\.?[0-9]+$/', $_GET['lat']) && preg_match('/^[+-]?[0-9]*\.?[0-9]+$/', $_GET['lon']))
+ {
+ $oReverseGeocode = new ReverseGeocode($oDB);
+ $oReverseGeocode->setLanguagePreference($aLangPrefOrder);
+
+ $oReverseGeocode->setLatLon($_GET['lat'], $_GET['lon']);
+ $oReverseGeocode->setZoom(@$_GET['zoom']);
+
+ $aLookup = $oReverseGeocode->lookup();
+ if (CONST_Debug) var_dump($aLookup);
+ }
+ else
+ {
+ $aLookup = null;
+ }
+
+ if ($aLookup)
+ {
+ $oPlaceLookup = new PlaceLookup($oDB);
+ $oPlaceLookup->setLanguagePreference($aLangPrefOrder);
+ $oPlaceLookup->setIncludeAddressDetails(getParamBool('addressdetails', true));
+ $oPlaceLookup->setIncludeExtraTags(getParamBool('extratags', false));
+ $oPlaceLookup->setIncludeNameDetails(getParamBool('namedetails', false));
+
+ $aPlace = $oPlaceLookup->lookupPlace($aLookup);
+
+ $oPlaceLookup->setIncludePolygonAsPoints($bAsPoints);
+ $oPlaceLookup->setIncludePolygonAsText($bAsText);
+ $oPlaceLookup->setIncludePolygonAsGeoJSON($bAsGeoJSON);
+ $oPlaceLookup->setIncludePolygonAsKML($bAsKML);
+ $oPlaceLookup->setIncludePolygonAsSVG($bAsSVG);
+ $oPlaceLookup->setPolygonSimplificationThreshold($fThreshold);
+
+ $fRadius = $fDiameter = getResultDiameter($aPlace);
+ $aOutlineResult = $oPlaceLookup->getOutlines($aPlace['place_id'], $aPlace['lon'], $aPlace['lat'], $fRadius);
+
+ if ($aOutlineResult)