简体   繁体   中英

How do I pass origin and destination co-ordinates to the Google Maps directions API?

I'm using the google maps api for directions but i'm having problems when i try to send the origin and destination as coordinates.it says in the documentation that i can do that

http://code.google.com/apis/maps/documentation/directions/#RequestParameters

but i am not sure of the format because it keeps giving me errors

Uncaught Error: Invalid value for property <origin>: [object Object]

i tried like so:

 {"Ja":27,"Ka":45}
 {latitude:27,longitude:45}

And all of the possible combinations above but still gives error which is weird because the objects are identical with the ones i should be sending.

只需提供以逗号分隔的latidute /经度作为文本值:

http://maps.google.com/maps/api/directions/json?origin= &destination= &sensor=false

使用Google distancematrix API:

https://maps.googleapis.com/maps/api/distancematrix/json?origins=-0.6566588,35.0881299&destinations=-0.6433411,35.094122&mode=driving

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM