I am trying to get the speed limit using the OSM through php. But, I am unable to do that because I am getting the message as written below:
The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.
What could be the problem? Below is my php file. Note: the code is still incomplete, I'm for now testing if I am able to access the OSM database.. But I cant. I hope someone could point me to the right direction..
<?php
$lat = 24.32633;
$lng = 54.58061;
$latm = -0.00015 + $lat;
$latp = 0.00015 + $lat;
$lngm = -0.00015 + $lng;
$lngp = 0.00015 + $lng;
//$json_url = 'http://overpass-api.de/api/interpreter?data=[out:json];node(24.326180, 54.580460,24.336580, 54.580860);way(bn);(._;>;);out;';
$json_url = 'http://overpass.osm.rambler.ru/cgi/interpreter';
$data = '<query type="way"> <bbox-query s="' . $lngm . '" w="' . $latm . '" n="' . $lngp . '" e="' . $latp . '"/> <!--this is auto-completed with the current map view coordinates.--> </query> <print/>';
$ch = curl_init( $json_url );
$options = array(
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $data,
CURLOPT_RETURNTRANSFER => true,
);
curl_setopt_array( $ch, $options );
$result = curl_exec($ch);
echo curl_exec($ch);
/*$resultArr = explode("<",$result);
foreach ($resultArr as $val) {
$temp = explode('"', $val);
//check the size of the array, if it is == 5, then do
if ($temp[1]=="maxspeed")
$speedlimit=$temp[3];
}
echo '{"speedlimit": "120"}'; */
?>