0
votes

I have to get a static map with three markers and a path between the markers, I have done this so far,

URL : http://maps.googleapis.com/maps/api/staticmap?maptype=terrain&scale=2&center=-0,0&size=600x600&zoom=1&markers=color:red%7Clabel:A%7C28.37,77.13&markers=color:green%7Clabel:B%7C46.227638,2.213749&markers=color:black%7Clabel:C%7C-40.900557,174.885971&path=color:blue%7Cweight=3%7C20.593684,78.96288%7C46.227638,2.213749%7C-40.900557,174.885971

Why is it starting from North America ?

the path keeps starting from North America although I have not provided it's coordinates anywhere in the URL. Why does this happen and how to rectify this ?

1

1 Answers

1
votes

I'm not 100% sure why it's not working for you, but I rearranged the arguments and it seems to work great for me:

http://maps.googleapis.com/maps/api/staticmap?size=600x600&center=0,0&maptype=terrain&scale=2&markers=color:red|label:A|28.37,77.13&markers=color:green|label:B|46.227638,2.213749&markers=color:black|label:C|-40.900557,174.885971&path=color:blue|weight:3|28.37,77.13|46.227638,2.213749|-40.900557,174.885971

You'll have to encode the | character if you're using it in a web app or something that doesn't handle encoding, otherwise a browser(Chrome works for me) should open this just fine.

Hope this works out for you!