谷歌地圖API ..谷歌地圖API響應
我想要兩個地址之間的最短路徑。
以下是我的代碼。
它的工作正常,但它返回不必要的信息,這就是爲什麼url請求花費太多時間來獲得響應。
$source = "ClinRad Diagnostics & Research Centre, 725, CMH Road, Near CMH Hospital, Indiranagar 1st stage, Bengaluru, Karnataka 560038";
$destination = "HENNUR POLICE STATION, Balachandra Layout, Babusabpalya, Hennur Gardens, Bengaluru, Karnataka 560043";
$url ='http://maps.googleapis.com/maps/api/directions/json?origin='.urlencode($source).'&destination='.urlencode($destination).'&alternatives=true&sensor=false&mode=driving';
$data = file_get_contents($url);
$response = json_decode($data);
echo "<pre>";
print_r($response);
效應初探陣列的詳細信息:https://jsfiddle.net/mbb5Lu32/
我要爭取在最短的路徑只有千米值..的事情其餘都是浪費我..
我怎樣才能像使用谷歌的具體信息地圖API?
在所示響應7.8公里最短值.. –
你能張貼JSON? –
請檢查https://jsfiddle.net/mbb5Lu32/3/ –