views:

25

answers:

2

Hey,

I succeeded in getting a google static map displaying a path between 2 coordinates.

The problem is that the drawn path is just a straight line between the 2 points.

I read that to be able to draw the "route" between 2 points on a static google map, as in, following the roads and city geography instead of the straight line, I need to add all the coordinates/crossroads for the path.

Does anyone knows an easy solution to solve this?

Thanks, P

+1  A: 

I think you cannot use this functionnality with the staticmap api. However you can use Directions with the JavaScript API V3.

MatTheCat
Thanks for your answer. Yeah get the directions and then generate the path, I knew you could do it that way, I just hoped someone already coded this process :)
Piero
+1  A: 

You can definitely do this with the Static Maps API:

get directions using DirectionsService:

http://code.google.com/apis/maps/documentation/javascript/reference.html#DirectionsService

and convert the overview path to suit the requirements of the Static Maps API:

http://code.google.com/apis/maps/documentation/staticmaps/#Paths

broady