對於我的應用程序,我需要一臺服務器來計算行車路線。使用PHP計算駕車路線?
該Google Maps API是專爲客戶端使用,使用Javascript和Flash API。有什麼方法可以運行他們的API的服務器端?
對於我的應用程序,我需要一臺服務器來計算行車路線。使用PHP計算駕車路線?
該Google Maps API是專爲客戶端使用,使用Javascript和Flash API。有什麼方法可以運行他們的API的服務器端?
我所知,這不是正式的和谷歌不支持它,但它的工作原理:
$url = str_replace(' ', '%20', "http://maps.google.com/maps/nav?client=yourclient&output=json&q=from: ".$lat1.",".$lon1." to: ".$lat2.",".$lon2);
$result = file_get_contents($url);
$data = json_decode(utf8_encode($result), true);
而且你必須在$ data數組的方向。
嗨, 是否必須是Google地圖,或者您可以使用Bing地圖嗎?如果是後者,您可以檢查Bing Maps SDK(http://www.microsoft.com/maps/developers/),因爲它提供了SOAP Web服務,我認爲這可以從服務器調用。 – keyboardP 2009-11-25 23:13:43
[Google Maps HTTP API for driving and walking directions]的可能重複(http://stackoverflow.com/questions/2041601/google-maps-http-api-for-driving-and-walking-directions) – miguev 2016-07-07 10:21:48