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 combina开发者_开发问答tions above but still gives error which is weird because the objects are identical with the ones i should be sending.
Just provide the latidute/longitude separated by a comma as textual value:
http://maps.google.com/maps/api/directions/json?origin=27.111,45.222&destination=28.333,46.444&sensor=false
Use Google distancematrix API:
https://maps.googleapis.com/maps/api/distancematrix/json?origins=-0.6566588,35.0881299&destinations=-0.6433411,35.094122&mode=driving
精彩评论