2014-02-17 59 views
-2

如何在Google的Directions API請求參數中傳遞Origin/Destination參數的LatLng值。以Google-maps-v3方向傳遞LatLng值API

訪問此鏈接: Google map driving direction source code for their example?

var request = { 
    origin: 'Chicago', // Here I want to add a latitude and Longitude value 
    destination: 'New York', 
    travelMode: google.maps.DirectionsTravelMode.DRIVING 
    }; 
+0

使用[google.maps.LatLng](https://developers.google.com/maps/documentation/javascript/reference#DirectionsRequest)作爲文檔中指定。 – geocodezip

回答

0

你應該只能夠使用新的谷歌緯度/經度對。例如:

origin: new google.maps.LatLng(51.2244, -12.12221) 
+0

我已經嘗試過,但是我給了一個Bad LatLng值。它的工作現在 – Tigga