+ $aLookup = $oReverseGeocode->lookup($fLat, $fLon);
+ if (CONST_Debug) var_dump($aLookup);
+
+ $aPlace = $oPlaceLookup->lookup(
+ (int)$aLookup['place_id'],
+ $aLookup['type'],
+ $aLookup['fraction']
+ );
+} elseif ($sOutputFormat != 'html') {
+ userError("Need coordinates or OSM object to lookup.");
+}
+
+if (isset($aPlace)) {
+ $oPlaceLookup->setIncludePolygonAsPoints(false);
+ $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) {
+ $aPlace = array_merge($aPlace, $aOutlineResult);
+ }
+} else {
+ $aPlace = [];
+}
+
+logEnd($oDB, $hLog, sizeof($aPlace)?1:0);
+
+if (CONST_Debug) {
+ var_dump($aPlace);
+ exit;
+}
+
+if ($sOutputFormat == 'html') {
+ $sDataDate = chksql($oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"));
+ $sTileURL = CONST_Map_Tile_URL;
+ $sTileAttribution = CONST_Map_Tile_Attribution;
+}
+include(CONST_BasePath.'/lib/template/address-'.$sOutputFormat.'.php');