Search code examples
google-maps-api-3google-maps-static-api

Google Maps - static map with direction marks


Is there a way using static maps that google maps can display directions drawn on the image as with the javascript API. That is a way of loading the static map image with the route to be taken drawn on them.

Any ideas?

Marvellous


Solution

  • The static maps API only supports markers, not directions. You've have to use the normal Javascript API. You could lock down the zoom/drag/scroll options etc so for all intents and purposes it could appear static to the user.

    Although in fact you can draw polylines, just not the proper directions:

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

    Here's an example:

    <img src="https://maps.googleapis.com/maps/api/staticmap?size=400x400&amp;path=color:0xff0000ff|weight:5|51.511333,-0.119355|51.506205,-0.114462|51.507774,-0.10861|51.507801,-0.107569|51.5071,-0.107344|51.507207,-0.105016|51.507507,-0.104404|51.510999,-0.104297">