-<?php\r
- header ("Content-Type: application/json; charset=UTF-8");\r
- header("Access-Control-Allow-Origin: *");\r
-\r
- $aFilteredPlaces = array();\r
-\r
- if (!sizeof($aPlace))\r
- {\r
- if ($sError)\r
- $aFilteredPlaces['error'] = $sError;\r
- else\r
- $aFilteredPlaces['error'] = 'Unable to geocode';\r
- }\r
- else\r
- {\r
- if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];\r
- $aFilteredPlaces['licence'] = "Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.";\r
- $sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));\r
- if ($sOSMType)\r
- {\r
- $aFilteredPlaces['osm_type'] = $sOSMType;\r
- $aFilteredPlaces['osm_id'] = $aPlace['osm_id'];\r
- }\r
- if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];\r
- if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];\r
- $aFilteredPlaces['display_name'] = $aPlace['langaddress'];\r
- $aFilteredPlaces['address'] = $aAddress;\r
- }\r
-\r
- if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))\r
- {\r
- echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';\r
- }\r
- else\r
- {\r
- echo javascript_renderData($aFilteredPlaces);\r
- }\r
-\r
-\r
+<?php
+ header ("Content-Type: application/json; charset=UTF-8");
+ header("Access-Control-Allow-Origin: *");
+
+ $aFilteredPlaces = array();
+
+ if (!sizeof($aPlace))
+ {
+ if ($sError)
+ $aFilteredPlaces['error'] = $sError;
+ else
+ $aFilteredPlaces['error'] = 'Unable to geocode';
+ }
+ else
+ {
+ if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
+ $aFilteredPlaces['licence'] = "Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.";
+ $sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));
+ if ($sOSMType)
+ {
+ $aFilteredPlaces['osm_type'] = $sOSMType;
+ $aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
+ }
+ if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
+ if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];
+ $aFilteredPlaces['display_name'] = $aPlace['langaddress'];
+ $aFilteredPlaces['address'] = $aAddress;
+ }
+
+ if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))
+ {
+ echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
+ }
+ else
+ {
+ echo javascript_renderData($aFilteredPlaces);
+ }
+
+
-<?php\r
- header ("Content-Type: application/json; charset=UTF-8");\r
- header("Access-Control-Allow-Origin: *");\r
-\r
- $aFilteredPlaces = array();\r
-\r
- if (!sizeof($aPlace))\r
- {\r
- if ($sError)\r
- $aFilteredPlaces['error'] = $sError;\r
- else\r
- $aFilteredPlaces['error'] = 'Unable to geocode';\r
- }\r
- else\r
- {\r
- if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];\r
- $aFilteredPlaces['licence'] = "Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.";\r
- $sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));\r
- if ($sOSMType)\r
- {\r
- $aFilteredPlaces['osm_type'] = $sOSMType;\r
- $aFilteredPlaces['osm_id'] = $aPlace['osm_id'];\r
- }\r
- if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];\r
- if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];\r
- $aFilteredPlaces['category'] = $aPlace['class'];\r
- $aFilteredPlaces['type'] = $aPlace['type'];\r
- $aFilteredPlaces['addresstype'] = strtolower($aPlace['addresstype']);\r
-\r
- $aFilteredPlaces['display_name'] = $aPlace['langaddress'];\r
- $aFilteredPlaces['name'] = $aPlace['placename'];\r
- $aFilteredPlaces['address'] = $aAddress;\r
- }\r
-\r
- if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_]+$/',$_GET['json_callback']))\r
- {\r
- echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';\r
- }\r
- else\r
- {\r
- echo javascript_renderData($aFilteredPlaces);\r
- }\r
-\r
-\r
+<?php
+ header ("Content-Type: application/json; charset=UTF-8");
+ header("Access-Control-Allow-Origin: *");
+
+ $aFilteredPlaces = array();
+
+ if (!sizeof($aPlace))
+ {
+ if ($sError)
+ $aFilteredPlaces['error'] = $sError;
+ else
+ $aFilteredPlaces['error'] = 'Unable to geocode';
+ }
+ else
+ {
+ if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
+ $aFilteredPlaces['licence'] = "Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.";
+ $sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));
+ if ($sOSMType)
+ {
+ $aFilteredPlaces['osm_type'] = $sOSMType;
+ $aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
+ }
+ if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
+ if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];
+ $aFilteredPlaces['category'] = $aPlace['class'];
+ $aFilteredPlaces['type'] = $aPlace['type'];
+ $aFilteredPlaces['addresstype'] = strtolower($aPlace['addresstype']);
+
+ $aFilteredPlaces['display_name'] = $aPlace['langaddress'];
+ $aFilteredPlaces['name'] = $aPlace['placename'];
+ $aFilteredPlaces['address'] = $aAddress;
+ }
+
+ if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_]+$/',$_GET['json_callback']))
+ {
+ echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
+ }
+ else
+ {
+ echo javascript_renderData($aFilteredPlaces);
+ }
+
+
-<?php\r
- header("content-type: text/xml; charset=UTF-8");\r
- header("Access-Control-Allow-Origin: *");\r
-\r
- echo "<";\r
- echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";\r
- echo ">\n";\r
-\r
- echo "<reversegeocode";\r
- echo " timestamp='".date(DATE_RFC822)."'";\r
- echo " attribution='Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.'";\r
- echo " querystring='".htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES)."'";\r
- echo ">\n";\r
-\r
- if (!sizeof($aPlace))\r
- {\r
- if ($sError)\r
- echo "<error>$sError</error>";\r
- else\r
- echo "<error>Unable to geocode</error>";\r
- }\r
- else\r
- {\r
- echo "<result";\r
- if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';\r
- if ($aPlace['osm_type'] && $aPlace['osm_id']) echo ' osm_type="'.($aPlace['osm_type']=='N'?'node':($aPlace['osm_type']=='W'?'way':'relation')).'"'.' osm_id="'.$aPlace['osm_id'].'"';\r
- if ($aPlace['ref']) echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';\r
- if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';\r
- if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';\r
- echo ">".htmlspecialchars($aPlace['langaddress'])."</result>";\r
-\r
- if ($bShowAddressDetails) {\r
- echo "<addressparts>";\r
- foreach($aAddress as $sKey => $sValue)\r
- {\r
- $sKey = str_replace(' ','_',$sKey);\r
- echo "<$sKey>";\r
- echo htmlspecialchars($sValue);\r
- echo "</$sKey>";\r
- }\r
- echo "</addressparts>";\r
- }\r
- }\r
- \r
- echo "</reversegeocode>";\r
+<?php
+ header("content-type: text/xml; charset=UTF-8");
+ header("Access-Control-Allow-Origin: *");
+
+ echo "<";
+ echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
+ echo ">\n";
+
+ echo "<reversegeocode";
+ echo " timestamp='".date(DATE_RFC822)."'";
+ echo " attribution='Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.'";
+ echo " querystring='".htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES)."'";
+ echo ">\n";
+
+ if (!sizeof($aPlace))
+ {
+ if ($sError)
+ echo "<error>$sError</error>";
+ else
+ echo "<error>Unable to geocode</error>";
+ }
+ else
+ {
+ echo "<result";
+ if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';
+ if ($aPlace['osm_type'] && $aPlace['osm_id']) echo ' osm_type="'.($aPlace['osm_type']=='N'?'node':($aPlace['osm_type']=='W'?'way':'relation')).'"'.' osm_id="'.$aPlace['osm_id'].'"';
+ if ($aPlace['ref']) echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
+ if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
+ if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
+ echo ">".htmlspecialchars($aPlace['langaddress'])."</result>";
+
+ if ($bShowAddressDetails) {
+ echo "<addressparts>";
+ foreach($aAddress as $sKey => $sValue)
+ {
+ $sKey = str_replace(' ','_',$sKey);
+ echo "<$sKey>";
+ echo htmlspecialchars($sValue);
+ echo "</$sKey>";
+ }
+ echo "</addressparts>";
+ }
+ }
+
+ echo "</reversegeocode>";
-<?php\r
- header("Content-Type: application/json; charset=UTF-8");\r
- header("Access-Control-Allow-Origin: *");\r
-\r
- $aFilteredPlaces = array();\r
- foreach($aSearchResults as $iResNum => $aPointDetails)\r
- {\r
- $aPlace = array(\r
- 'place_id'=>$aPointDetails['place_id'],\r
- 'licence'=>"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.",\r
- );\r
-\r
- $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));\r
- if ($sOSMType)\r
- {\r
- $aPlace['osm_type'] = $sOSMType;\r
- $aPlace['osm_id'] = $aPointDetails['osm_id'];\r
- }\r
-\r
- if (isset($aPointDetails['aBoundingBox']))\r
- {\r
- $aPlace['boundingbox'] = array(\r
- $aPointDetails['aBoundingBox'][0],\r
- $aPointDetails['aBoundingBox'][1],\r
- $aPointDetails['aBoundingBox'][2],\r
- $aPointDetails['aBoundingBox'][3]);\r
-\r
- if (isset($aPointDetails['aPolyPoints']) && $bShowPolygons)\r
- {\r
- $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];\r
- }\r
- }\r
-\r
- if (isset($aPointDetails['zoom']))\r
- {\r
- $aPlace['zoom'] = $aPointDetails['zoom'];\r
- }\r
-\r
- $aPlace['lat'] = $aPointDetails['lat'];\r
- $aPlace['lon'] = $aPointDetails['lon'];\r
- $aPlace['display_name'] = $aPointDetails['name'];\r
-\r
- $aPlace['class'] = $aPointDetails['class'];\r
- $aPlace['type'] = $aPointDetails['type'];\r
- if ($aPointDetails['icon'])\r
- {\r
- $aPlace['icon'] = $aPointDetails['icon'];\r
- }\r
-\r
- if (isset($aPointDetails['address']))\r
- {\r
- $aPlace['address'] = $aPointDetails['address'];\r
- }\r
-\r
- $aFilteredPlaces[] = $aPlace;\r
- }\r
-\r
- if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))\r
- {\r
- echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';\r
- }\r
- else\r
- {\r
- echo javascript_renderData($aFilteredPlaces);\r
- }\r
+<?php
+ header("Content-Type: application/json; charset=UTF-8");
+ header("Access-Control-Allow-Origin: *");
+
+ $aFilteredPlaces = array();
+ foreach($aSearchResults as $iResNum => $aPointDetails)
+ {
+ $aPlace = array(
+ 'place_id'=>$aPointDetails['place_id'],
+ 'licence'=>"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.",
+ );
+
+ $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
+ if ($sOSMType)
+ {
+ $aPlace['osm_type'] = $sOSMType;
+ $aPlace['osm_id'] = $aPointDetails['osm_id'];
+ }
+
+ if (isset($aPointDetails['aBoundingBox']))
+ {
+ $aPlace['boundingbox'] = array(
+ $aPointDetails['aBoundingBox'][0],
+ $aPointDetails['aBoundingBox'][1],
+ $aPointDetails['aBoundingBox'][2],
+ $aPointDetails['aBoundingBox'][3]);
+
+ if (isset($aPointDetails['aPolyPoints']) && $bShowPolygons)
+ {
+ $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
+ }
+ }
+
+ if (isset($aPointDetails['zoom']))
+ {
+ $aPlace['zoom'] = $aPointDetails['zoom'];
+ }
+
+ $aPlace['lat'] = $aPointDetails['lat'];
+ $aPlace['lon'] = $aPointDetails['lon'];
+ $aPlace['display_name'] = $aPointDetails['name'];
+
+ $aPlace['class'] = $aPointDetails['class'];
+ $aPlace['type'] = $aPointDetails['type'];
+ if ($aPointDetails['icon'])
+ {
+ $aPlace['icon'] = $aPointDetails['icon'];
+ }
+
+ if (isset($aPointDetails['address']))
+ {
+ $aPlace['address'] = $aPointDetails['address'];
+ }
+
+ $aFilteredPlaces[] = $aPlace;
+ }
+
+ if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))
+ {
+ echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
+ }
+ else
+ {
+ echo javascript_renderData($aFilteredPlaces);
+ }
-<?php\r
- header("Content-Type: application/json; charset=UTF-8");\r
- header("Access-Control-Allow-Origin: *");\r
-\r
- $aFilteredPlaces = array();\r
- foreach($aSearchResults as $iResNum => $aPointDetails)\r
- {\r
- $aPlace = array(\r
- 'place_id'=>$aPointDetails['place_id'],\r
- 'licence'=>"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.",\r
- );\r
-\r
- $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));\r
- if ($sOSMType)\r
- {\r
- $aPlace['osm_type'] = $sOSMType;\r
- $aPlace['osm_id'] = $aPointDetails['osm_id'];\r
- }\r
-\r
- if (isset($aPointDetails['aBoundingBox']))\r
- {\r
- $aPlace['boundingbox'] = array(\r
- $aPointDetails['aBoundingBox'][0],\r
- $aPointDetails['aBoundingBox'][1],\r
- $aPointDetails['aBoundingBox'][2],\r
- $aPointDetails['aBoundingBox'][3]);\r
-\r
- if (isset($aPointDetails['aPolyPoints']) && $bShowPolygons)\r
- {\r
- $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];\r
- }\r
- }\r
-\r
- if (isset($aPointDetails['zoom']))\r
- {\r
- $aPlace['zoom'] = $aPointDetails['zoom'];\r
- }\r
-\r
- $aPlace['lat'] = $aPointDetails['lat'];\r
- $aPlace['lon'] = $aPointDetails['lon'];\r
- $aPlace['display_name'] = $aPointDetails['name'];\r
-\r
- $aPlace['category'] = $aPointDetails['class'];\r
- $aPlace['type'] = $aPointDetails['type'];\r
- if ($aPointDetails['icon'])\r
- {\r
- $aPlace['icon'] = $aPointDetails['icon'];\r
- }\r
-\r
- if (isset($aPointDetails['address']))\r
- {\r
- $aPlace['address'] = $aPointDetails['address'];\r
- }\r
-\r
- $aFilteredPlaces[] = $aPlace;\r
- }\r
-\r
- if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))\r
- {\r
- echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';\r
- }\r
- else\r
- {\r
- echo javascript_renderData($aFilteredPlaces);\r
- }\r
+<?php
+ header("Content-Type: application/json; charset=UTF-8");
+ header("Access-Control-Allow-Origin: *");
+
+ $aFilteredPlaces = array();
+ foreach($aSearchResults as $iResNum => $aPointDetails)
+ {
+ $aPlace = array(
+ 'place_id'=>$aPointDetails['place_id'],
+ 'licence'=>"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.",
+ );
+
+ $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
+ if ($sOSMType)
+ {
+ $aPlace['osm_type'] = $sOSMType;
+ $aPlace['osm_id'] = $aPointDetails['osm_id'];
+ }
+
+ if (isset($aPointDetails['aBoundingBox']))
+ {
+ $aPlace['boundingbox'] = array(
+ $aPointDetails['aBoundingBox'][0],
+ $aPointDetails['aBoundingBox'][1],
+ $aPointDetails['aBoundingBox'][2],
+ $aPointDetails['aBoundingBox'][3]);
+
+ if (isset($aPointDetails['aPolyPoints']) && $bShowPolygons)
+ {
+ $aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
+ }
+ }
+
+ if (isset($aPointDetails['zoom']))
+ {
+ $aPlace['zoom'] = $aPointDetails['zoom'];
+ }
+
+ $aPlace['lat'] = $aPointDetails['lat'];
+ $aPlace['lon'] = $aPointDetails['lon'];
+ $aPlace['display_name'] = $aPointDetails['name'];
+
+ $aPlace['category'] = $aPointDetails['class'];
+ $aPlace['type'] = $aPointDetails['type'];
+ if ($aPointDetails['icon'])
+ {
+ $aPlace['icon'] = $aPointDetails['icon'];
+ }
+
+ if (isset($aPointDetails['address']))
+ {
+ $aPlace['address'] = $aPointDetails['address'];
+ }
+
+ $aFilteredPlaces[] = $aPlace;
+ }
+
+ if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))
+ {
+ echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
+ }
+ else
+ {
+ echo javascript_renderData($aFilteredPlaces);
+ }
-<?php\r
- header("content-type: text/xml; charset=UTF-8");\r
- header("Access-Control-Allow-Origin: *");\r
-\r
- echo "<";\r
- echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";\r
- echo ">\n";\r
-\r
- echo "<searchresults";\r
- echo " timestamp='".date(DATE_RFC822)."'";\r
- echo " attribution='Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.'";\r
- echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";\r
- if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";\r
- echo " polygon='".($bShowPolygons?'true':'false')."'";\r
- if (sizeof($aExcludePlaceIDs))\r
- {\r
- echo " exclude_place_ids='".htmlspecialchars(join(',',$aExcludePlaceIDs))."'";\r
- }\r
- if ($sMoreURL)\r
- {\r
- echo " more_url='".htmlspecialchars($sMoreURL)."'";\r
- }\r
- echo ">\n";\r
-\r
- foreach($aSearchResults as $iResNum => $aResult)\r
- {\r
- echo "<place place_id='".$aResult['place_id']."'";\r
- $sOSMType = ($aResult['osm_type'] == 'N'?'node':($aResult['osm_type'] == 'W'?'way':($aResult['osm_type'] == 'R'?'relation':'')));\r
- if ($sOSMType)\r
- {\r
- echo " osm_type='$sOSMType'";\r
- echo " osm_id='".$aResult['osm_id']."'";\r
- }\r
- echo " place_rank='".$aResult['rank_search']."'";\r
-\r
- if (isset($aResult['aBoundingBox']))\r
- {\r
- echo ' boundingbox="';\r
- echo $aResult['aBoundingBox'][0];\r
- echo ','.$aResult['aBoundingBox'][1];\r
- echo ','.$aResult['aBoundingBox'][2];\r
- echo ','.$aResult['aBoundingBox'][3];\r
- echo '"';\r
-\r
- if ($bShowPolygons && isset($aResult['aPolyPoints']))\r
- {\r
- echo ' polygonpoints=\'';\r
- echo javascript_renderData($aResult['aPolyPoints']);\r
- echo '\'';\r
- }\r
- }\r
-\r
- if (isset($aResult['zoom']))\r
- {\r
- echo " zoom='".$aResult['zoom']."'";\r
- }\r
-\r
- echo " lat='".$aResult['lat']."'";\r
- echo " lon='".$aResult['lon']."'";\r
- echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";\r
-\r
- echo " class='".htmlspecialchars($aResult['class'])."'";\r
- echo " type='".htmlspecialchars($aResult['type'])."'";\r
- if ($aResult['icon'])\r
- {\r
- echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";\r
- }\r
-\r
- if (isset($aResult['address']))\r
- {\r
- echo ">";\r
- foreach($aResult['address'] as $sKey => $sValue)\r
- {\r
- $sKey = str_replace(' ','_',$sKey);\r
- echo "<$sKey>";\r
- echo htmlspecialchars($sValue);\r
- echo "</$sKey>";\r
- }\r
-\r
- echo "</place>";\r
- }\r
- else\r
- {\r
- echo "/>";\r
- }\r
- }\r
- \r
- echo "</searchresults>";\r
+<?php
+ header("content-type: text/xml; charset=UTF-8");
+ header("Access-Control-Allow-Origin: *");
+
+ echo "<";
+ echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
+ echo ">\n";
+
+ echo "<searchresults";
+ echo " timestamp='".date(DATE_RFC822)."'";
+ echo " attribution='Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.'";
+ echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
+ if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
+ echo " polygon='".($bShowPolygons?'true':'false')."'";
+ if (sizeof($aExcludePlaceIDs))
+ {
+ echo " exclude_place_ids='".htmlspecialchars(join(',',$aExcludePlaceIDs))."'";
+ }
+ if ($sMoreURL)
+ {
+ echo " more_url='".htmlspecialchars($sMoreURL)."'";
+ }
+ echo ">\n";
+
+ foreach($aSearchResults as $iResNum => $aResult)
+ {
+ echo "<place place_id='".$aResult['place_id']."'";
+ $sOSMType = ($aResult['osm_type'] == 'N'?'node':($aResult['osm_type'] == 'W'?'way':($aResult['osm_type'] == 'R'?'relation':'')));
+ if ($sOSMType)
+ {
+ echo " osm_type='$sOSMType'";
+ echo " osm_id='".$aResult['osm_id']."'";
+ }
+ echo " place_rank='".$aResult['rank_search']."'";
+
+ if (isset($aResult['aBoundingBox']))
+ {
+ echo ' boundingbox="';
+ echo $aResult['aBoundingBox'][0];
+ echo ','.$aResult['aBoundingBox'][1];
+ echo ','.$aResult['aBoundingBox'][2];
+ echo ','.$aResult['aBoundingBox'][3];
+ echo '"';
+
+ if ($bShowPolygons && isset($aResult['aPolyPoints']))
+ {
+ echo ' polygonpoints=\'';
+ echo javascript_renderData($aResult['aPolyPoints']);
+ echo '\'';
+ }
+ }
+
+ if (isset($aResult['zoom']))
+ {
+ echo " zoom='".$aResult['zoom']."'";
+ }
+
+ echo " lat='".$aResult['lat']."'";
+ echo " lon='".$aResult['lon']."'";
+ echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";
+
+ echo " class='".htmlspecialchars($aResult['class'])."'";
+ echo " type='".htmlspecialchars($aResult['type'])."'";
+ if ($aResult['icon'])
+ {
+ echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";
+ }
+
+ if (isset($aResult['address']))
+ {
+ echo ">";
+ foreach($aResult['address'] as $sKey => $sValue)
+ {
+ $sKey = str_replace(' ','_',$sKey);
+ echo "<$sKey>";
+ echo htmlspecialchars($sValue);
+ echo "</$sKey>";
+ }
+
+ echo "</place>";
+ }
+ else
+ {
+ echo "/>";
+ }
+ }
+
+ echo "</searchresults>";