mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 13:24:07 +00:00
convert CRLF to make git happy
This commit is contained in:
@@ -1,39 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
header ("Content-Type: application/json; charset=UTF-8");
|
header ("Content-Type: application/json; charset=UTF-8");
|
||||||
header("Access-Control-Allow-Origin: *");
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
|
||||||
$aFilteredPlaces = array();
|
$aFilteredPlaces = array();
|
||||||
|
|
||||||
if (!sizeof($aPlace))
|
if (!sizeof($aPlace))
|
||||||
{
|
{
|
||||||
if ($sError)
|
if ($sError)
|
||||||
$aFilteredPlaces['error'] = $sError;
|
$aFilteredPlaces['error'] = $sError;
|
||||||
else
|
else
|
||||||
$aFilteredPlaces['error'] = 'Unable to geocode';
|
$aFilteredPlaces['error'] = 'Unable to geocode';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
||||||
$aFilteredPlaces['licence'] = "Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.";
|
$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':'')));
|
$sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
$aFilteredPlaces['osm_type'] = $sOSMType;
|
$aFilteredPlaces['osm_type'] = $sOSMType;
|
||||||
$aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
|
$aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
|
||||||
}
|
}
|
||||||
if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
|
if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
|
||||||
if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];
|
if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];
|
||||||
$aFilteredPlaces['display_name'] = $aPlace['langaddress'];
|
$aFilteredPlaces['display_name'] = $aPlace['langaddress'];
|
||||||
$aFilteredPlaces['address'] = $aAddress;
|
$aFilteredPlaces['address'] = $aAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))
|
if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))
|
||||||
{
|
{
|
||||||
echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
|
echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo javascript_renderData($aFilteredPlaces);
|
echo javascript_renderData($aFilteredPlaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,44 +1,44 @@
|
|||||||
<?php
|
<?php
|
||||||
header ("Content-Type: application/json; charset=UTF-8");
|
header ("Content-Type: application/json; charset=UTF-8");
|
||||||
header("Access-Control-Allow-Origin: *");
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
|
||||||
$aFilteredPlaces = array();
|
$aFilteredPlaces = array();
|
||||||
|
|
||||||
if (!sizeof($aPlace))
|
if (!sizeof($aPlace))
|
||||||
{
|
{
|
||||||
if ($sError)
|
if ($sError)
|
||||||
$aFilteredPlaces['error'] = $sError;
|
$aFilteredPlaces['error'] = $sError;
|
||||||
else
|
else
|
||||||
$aFilteredPlaces['error'] = 'Unable to geocode';
|
$aFilteredPlaces['error'] = 'Unable to geocode';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
||||||
$aFilteredPlaces['licence'] = "Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.";
|
$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':'')));
|
$sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
$aFilteredPlaces['osm_type'] = $sOSMType;
|
$aFilteredPlaces['osm_type'] = $sOSMType;
|
||||||
$aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
|
$aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
|
||||||
}
|
}
|
||||||
if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
|
if (isset($aPlace['lat'])) $aFilteredPlaces['lat'] = $aPlace['lat'];
|
||||||
if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];
|
if (isset($aPlace['lon'])) $aFilteredPlaces['lon'] = $aPlace['lon'];
|
||||||
$aFilteredPlaces['category'] = $aPlace['class'];
|
$aFilteredPlaces['category'] = $aPlace['class'];
|
||||||
$aFilteredPlaces['type'] = $aPlace['type'];
|
$aFilteredPlaces['type'] = $aPlace['type'];
|
||||||
$aFilteredPlaces['addresstype'] = strtolower($aPlace['addresstype']);
|
$aFilteredPlaces['addresstype'] = strtolower($aPlace['addresstype']);
|
||||||
|
|
||||||
$aFilteredPlaces['display_name'] = $aPlace['langaddress'];
|
$aFilteredPlaces['display_name'] = $aPlace['langaddress'];
|
||||||
$aFilteredPlaces['name'] = $aPlace['placename'];
|
$aFilteredPlaces['name'] = $aPlace['placename'];
|
||||||
$aFilteredPlaces['address'] = $aAddress;
|
$aFilteredPlaces['address'] = $aAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_]+$/',$_GET['json_callback']))
|
if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_]+$/',$_GET['json_callback']))
|
||||||
{
|
{
|
||||||
echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
|
echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo javascript_renderData($aFilteredPlaces);
|
echo javascript_renderData($aFilteredPlaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +1,45 @@
|
|||||||
<?php
|
<?php
|
||||||
header("content-type: text/xml; charset=UTF-8");
|
header("content-type: text/xml; charset=UTF-8");
|
||||||
header("Access-Control-Allow-Origin: *");
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
|
||||||
echo "<";
|
echo "<";
|
||||||
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
|
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
|
|
||||||
echo "<reversegeocode";
|
echo "<reversegeocode";
|
||||||
echo " timestamp='".date(DATE_RFC822)."'";
|
echo " timestamp='".date(DATE_RFC822)."'";
|
||||||
echo " attribution='Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.'";
|
echo " attribution='Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.'";
|
||||||
echo " querystring='".htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES)."'";
|
echo " querystring='".htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES)."'";
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
|
|
||||||
if (!sizeof($aPlace))
|
if (!sizeof($aPlace))
|
||||||
{
|
{
|
||||||
if ($sError)
|
if ($sError)
|
||||||
echo "<error>$sError</error>";
|
echo "<error>$sError</error>";
|
||||||
else
|
else
|
||||||
echo "<error>Unable to geocode</error>";
|
echo "<error>Unable to geocode</error>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "<result";
|
echo "<result";
|
||||||
if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';
|
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['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 ($aPlace['ref']) echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
|
||||||
if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
|
if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
|
||||||
if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
|
if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
|
||||||
echo ">".htmlspecialchars($aPlace['langaddress'])."</result>";
|
echo ">".htmlspecialchars($aPlace['langaddress'])."</result>";
|
||||||
|
|
||||||
if ($bShowAddressDetails) {
|
if ($bShowAddressDetails) {
|
||||||
echo "<addressparts>";
|
echo "<addressparts>";
|
||||||
foreach($aAddress as $sKey => $sValue)
|
foreach($aAddress as $sKey => $sValue)
|
||||||
{
|
{
|
||||||
$sKey = str_replace(' ','_',$sKey);
|
$sKey = str_replace(' ','_',$sKey);
|
||||||
echo "<$sKey>";
|
echo "<$sKey>";
|
||||||
echo htmlspecialchars($sValue);
|
echo htmlspecialchars($sValue);
|
||||||
echo "</$sKey>";
|
echo "</$sKey>";
|
||||||
}
|
}
|
||||||
echo "</addressparts>";
|
echo "</addressparts>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</reversegeocode>";
|
echo "</reversegeocode>";
|
||||||
|
|||||||
@@ -1,65 +1,65 @@
|
|||||||
<?php
|
<?php
|
||||||
header("Content-Type: application/json; charset=UTF-8");
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
header("Access-Control-Allow-Origin: *");
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
|
||||||
$aFilteredPlaces = array();
|
$aFilteredPlaces = array();
|
||||||
foreach($aSearchResults as $iResNum => $aPointDetails)
|
foreach($aSearchResults as $iResNum => $aPointDetails)
|
||||||
{
|
{
|
||||||
$aPlace = array(
|
$aPlace = array(
|
||||||
'place_id'=>$aPointDetails['place_id'],
|
'place_id'=>$aPointDetails['place_id'],
|
||||||
'licence'=>"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.",
|
'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':'')));
|
$sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
$aPlace['osm_type'] = $sOSMType;
|
$aPlace['osm_type'] = $sOSMType;
|
||||||
$aPlace['osm_id'] = $aPointDetails['osm_id'];
|
$aPlace['osm_id'] = $aPointDetails['osm_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aPointDetails['aBoundingBox']))
|
if (isset($aPointDetails['aBoundingBox']))
|
||||||
{
|
{
|
||||||
$aPlace['boundingbox'] = array(
|
$aPlace['boundingbox'] = array(
|
||||||
$aPointDetails['aBoundingBox'][0],
|
$aPointDetails['aBoundingBox'][0],
|
||||||
$aPointDetails['aBoundingBox'][1],
|
$aPointDetails['aBoundingBox'][1],
|
||||||
$aPointDetails['aBoundingBox'][2],
|
$aPointDetails['aBoundingBox'][2],
|
||||||
$aPointDetails['aBoundingBox'][3]);
|
$aPointDetails['aBoundingBox'][3]);
|
||||||
|
|
||||||
if (isset($aPointDetails['aPolyPoints']) && $bShowPolygons)
|
if (isset($aPointDetails['aPolyPoints']) && $bShowPolygons)
|
||||||
{
|
{
|
||||||
$aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
|
$aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aPointDetails['zoom']))
|
if (isset($aPointDetails['zoom']))
|
||||||
{
|
{
|
||||||
$aPlace['zoom'] = $aPointDetails['zoom'];
|
$aPlace['zoom'] = $aPointDetails['zoom'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$aPlace['lat'] = $aPointDetails['lat'];
|
$aPlace['lat'] = $aPointDetails['lat'];
|
||||||
$aPlace['lon'] = $aPointDetails['lon'];
|
$aPlace['lon'] = $aPointDetails['lon'];
|
||||||
$aPlace['display_name'] = $aPointDetails['name'];
|
$aPlace['display_name'] = $aPointDetails['name'];
|
||||||
|
|
||||||
$aPlace['class'] = $aPointDetails['class'];
|
$aPlace['class'] = $aPointDetails['class'];
|
||||||
$aPlace['type'] = $aPointDetails['type'];
|
$aPlace['type'] = $aPointDetails['type'];
|
||||||
if ($aPointDetails['icon'])
|
if ($aPointDetails['icon'])
|
||||||
{
|
{
|
||||||
$aPlace['icon'] = $aPointDetails['icon'];
|
$aPlace['icon'] = $aPointDetails['icon'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aPointDetails['address']))
|
if (isset($aPointDetails['address']))
|
||||||
{
|
{
|
||||||
$aPlace['address'] = $aPointDetails['address'];
|
$aPlace['address'] = $aPointDetails['address'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$aFilteredPlaces[] = $aPlace;
|
$aFilteredPlaces[] = $aPlace;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))
|
if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))
|
||||||
{
|
{
|
||||||
echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
|
echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo javascript_renderData($aFilteredPlaces);
|
echo javascript_renderData($aFilteredPlaces);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,65 +1,65 @@
|
|||||||
<?php
|
<?php
|
||||||
header("Content-Type: application/json; charset=UTF-8");
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
header("Access-Control-Allow-Origin: *");
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
|
||||||
$aFilteredPlaces = array();
|
$aFilteredPlaces = array();
|
||||||
foreach($aSearchResults as $iResNum => $aPointDetails)
|
foreach($aSearchResults as $iResNum => $aPointDetails)
|
||||||
{
|
{
|
||||||
$aPlace = array(
|
$aPlace = array(
|
||||||
'place_id'=>$aPointDetails['place_id'],
|
'place_id'=>$aPointDetails['place_id'],
|
||||||
'licence'=>"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.",
|
'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':'')));
|
$sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
$aPlace['osm_type'] = $sOSMType;
|
$aPlace['osm_type'] = $sOSMType;
|
||||||
$aPlace['osm_id'] = $aPointDetails['osm_id'];
|
$aPlace['osm_id'] = $aPointDetails['osm_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aPointDetails['aBoundingBox']))
|
if (isset($aPointDetails['aBoundingBox']))
|
||||||
{
|
{
|
||||||
$aPlace['boundingbox'] = array(
|
$aPlace['boundingbox'] = array(
|
||||||
$aPointDetails['aBoundingBox'][0],
|
$aPointDetails['aBoundingBox'][0],
|
||||||
$aPointDetails['aBoundingBox'][1],
|
$aPointDetails['aBoundingBox'][1],
|
||||||
$aPointDetails['aBoundingBox'][2],
|
$aPointDetails['aBoundingBox'][2],
|
||||||
$aPointDetails['aBoundingBox'][3]);
|
$aPointDetails['aBoundingBox'][3]);
|
||||||
|
|
||||||
if (isset($aPointDetails['aPolyPoints']) && $bShowPolygons)
|
if (isset($aPointDetails['aPolyPoints']) && $bShowPolygons)
|
||||||
{
|
{
|
||||||
$aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
|
$aPlace['polygonpoints'] = $aPointDetails['aPolyPoints'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aPointDetails['zoom']))
|
if (isset($aPointDetails['zoom']))
|
||||||
{
|
{
|
||||||
$aPlace['zoom'] = $aPointDetails['zoom'];
|
$aPlace['zoom'] = $aPointDetails['zoom'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$aPlace['lat'] = $aPointDetails['lat'];
|
$aPlace['lat'] = $aPointDetails['lat'];
|
||||||
$aPlace['lon'] = $aPointDetails['lon'];
|
$aPlace['lon'] = $aPointDetails['lon'];
|
||||||
$aPlace['display_name'] = $aPointDetails['name'];
|
$aPlace['display_name'] = $aPointDetails['name'];
|
||||||
|
|
||||||
$aPlace['category'] = $aPointDetails['class'];
|
$aPlace['category'] = $aPointDetails['class'];
|
||||||
$aPlace['type'] = $aPointDetails['type'];
|
$aPlace['type'] = $aPointDetails['type'];
|
||||||
if ($aPointDetails['icon'])
|
if ($aPointDetails['icon'])
|
||||||
{
|
{
|
||||||
$aPlace['icon'] = $aPointDetails['icon'];
|
$aPlace['icon'] = $aPointDetails['icon'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aPointDetails['address']))
|
if (isset($aPointDetails['address']))
|
||||||
{
|
{
|
||||||
$aPlace['address'] = $aPointDetails['address'];
|
$aPlace['address'] = $aPointDetails['address'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$aFilteredPlaces[] = $aPlace;
|
$aFilteredPlaces[] = $aPlace;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))
|
if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))
|
||||||
{
|
{
|
||||||
echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
|
echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo javascript_renderData($aFilteredPlaces);
|
echo javascript_renderData($aFilteredPlaces);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,88 +1,88 @@
|
|||||||
<?php
|
<?php
|
||||||
header("content-type: text/xml; charset=UTF-8");
|
header("content-type: text/xml; charset=UTF-8");
|
||||||
header("Access-Control-Allow-Origin: *");
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
|
||||||
echo "<";
|
echo "<";
|
||||||
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
|
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
|
|
||||||
echo "<searchresults";
|
echo "<searchresults";
|
||||||
echo " timestamp='".date(DATE_RFC822)."'";
|
echo " timestamp='".date(DATE_RFC822)."'";
|
||||||
echo " attribution='Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.'";
|
echo " attribution='Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.'";
|
||||||
echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
|
echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
|
||||||
if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
|
if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
|
||||||
echo " polygon='".($bShowPolygons?'true':'false')."'";
|
echo " polygon='".($bShowPolygons?'true':'false')."'";
|
||||||
if (sizeof($aExcludePlaceIDs))
|
if (sizeof($aExcludePlaceIDs))
|
||||||
{
|
{
|
||||||
echo " exclude_place_ids='".htmlspecialchars(join(',',$aExcludePlaceIDs))."'";
|
echo " exclude_place_ids='".htmlspecialchars(join(',',$aExcludePlaceIDs))."'";
|
||||||
}
|
}
|
||||||
if ($sMoreURL)
|
if ($sMoreURL)
|
||||||
{
|
{
|
||||||
echo " more_url='".htmlspecialchars($sMoreURL)."'";
|
echo " more_url='".htmlspecialchars($sMoreURL)."'";
|
||||||
}
|
}
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
|
|
||||||
foreach($aSearchResults as $iResNum => $aResult)
|
foreach($aSearchResults as $iResNum => $aResult)
|
||||||
{
|
{
|
||||||
echo "<place place_id='".$aResult['place_id']."'";
|
echo "<place place_id='".$aResult['place_id']."'";
|
||||||
$sOSMType = ($aResult['osm_type'] == 'N'?'node':($aResult['osm_type'] == 'W'?'way':($aResult['osm_type'] == 'R'?'relation':'')));
|
$sOSMType = ($aResult['osm_type'] == 'N'?'node':($aResult['osm_type'] == 'W'?'way':($aResult['osm_type'] == 'R'?'relation':'')));
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
echo " osm_type='$sOSMType'";
|
echo " osm_type='$sOSMType'";
|
||||||
echo " osm_id='".$aResult['osm_id']."'";
|
echo " osm_id='".$aResult['osm_id']."'";
|
||||||
}
|
}
|
||||||
echo " place_rank='".$aResult['rank_search']."'";
|
echo " place_rank='".$aResult['rank_search']."'";
|
||||||
|
|
||||||
if (isset($aResult['aBoundingBox']))
|
if (isset($aResult['aBoundingBox']))
|
||||||
{
|
{
|
||||||
echo ' boundingbox="';
|
echo ' boundingbox="';
|
||||||
echo $aResult['aBoundingBox'][0];
|
echo $aResult['aBoundingBox'][0];
|
||||||
echo ','.$aResult['aBoundingBox'][1];
|
echo ','.$aResult['aBoundingBox'][1];
|
||||||
echo ','.$aResult['aBoundingBox'][2];
|
echo ','.$aResult['aBoundingBox'][2];
|
||||||
echo ','.$aResult['aBoundingBox'][3];
|
echo ','.$aResult['aBoundingBox'][3];
|
||||||
echo '"';
|
echo '"';
|
||||||
|
|
||||||
if ($bShowPolygons && isset($aResult['aPolyPoints']))
|
if ($bShowPolygons && isset($aResult['aPolyPoints']))
|
||||||
{
|
{
|
||||||
echo ' polygonpoints=\'';
|
echo ' polygonpoints=\'';
|
||||||
echo javascript_renderData($aResult['aPolyPoints']);
|
echo javascript_renderData($aResult['aPolyPoints']);
|
||||||
echo '\'';
|
echo '\'';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aResult['zoom']))
|
if (isset($aResult['zoom']))
|
||||||
{
|
{
|
||||||
echo " zoom='".$aResult['zoom']."'";
|
echo " zoom='".$aResult['zoom']."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo " lat='".$aResult['lat']."'";
|
echo " lat='".$aResult['lat']."'";
|
||||||
echo " lon='".$aResult['lon']."'";
|
echo " lon='".$aResult['lon']."'";
|
||||||
echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";
|
echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";
|
||||||
|
|
||||||
echo " class='".htmlspecialchars($aResult['class'])."'";
|
echo " class='".htmlspecialchars($aResult['class'])."'";
|
||||||
echo " type='".htmlspecialchars($aResult['type'])."'";
|
echo " type='".htmlspecialchars($aResult['type'])."'";
|
||||||
if ($aResult['icon'])
|
if ($aResult['icon'])
|
||||||
{
|
{
|
||||||
echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";
|
echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aResult['address']))
|
if (isset($aResult['address']))
|
||||||
{
|
{
|
||||||
echo ">";
|
echo ">";
|
||||||
foreach($aResult['address'] as $sKey => $sValue)
|
foreach($aResult['address'] as $sKey => $sValue)
|
||||||
{
|
{
|
||||||
$sKey = str_replace(' ','_',$sKey);
|
$sKey = str_replace(' ','_',$sKey);
|
||||||
echo "<$sKey>";
|
echo "<$sKey>";
|
||||||
echo htmlspecialchars($sValue);
|
echo htmlspecialchars($sValue);
|
||||||
echo "</$sKey>";
|
echo "</$sKey>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</place>";
|
echo "</place>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "/>";
|
echo "/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</searchresults>";
|
echo "</searchresults>";
|
||||||
|
|||||||
Reference in New Issue
Block a user