Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 910
andrei Avatar asked Sep 24 '11 12:09

andrei


1 Answers

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

like image 98
Dr.Molle Avatar answered Nov 11 '22 06:11

Dr.Molle