2 header ("Content-Type: application/json; charset=UTF-8");
\r
3 header("Access-Control-Allow-Origin: *");
\r
5 $aFilteredPlaces = array();
\r
7 if (!sizeof($aPlace))
\r
10 $aFilteredPlaces['error'] = $sError;
\r
12 $aFilteredPlaces['error'] = 'Unable to geocode';
\r
16 if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
\r
17 $aFilteredPlaces['licence'] = "Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.";
\r
18 $sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));
\r
21 $aFilteredPlaces['osm_type'] = $sOSMType;
\r
22 $aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
\r
24 $aFilteredPlaces['display_name'] = $aPlace['langaddress'];
\r
25 $aFilteredPlaces['address'] = $aAddress;
\r
28 if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))
\r
30 echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
\r
34 echo javascript_renderData($aFilteredPlaces);
\r