Static Map with directions

638 views
Skip to first unread message

thiagohb

unread,
Dec 8, 2011, 2:45:55 PM12/8/11
to google-map...@googlegroups.com
Hi everybody, 

I want know if is possible get an image "with directions" on gif, png or jpeg format as the API v1 allows.
I need a static map that show the shorter way between two markers, the API v1 has the option path, but this option connects the two points by a line that ignore builds, streets and avenues.

Thank you in advance for any help you can provide.

Andrew Leach

unread,
Dec 8, 2011, 3:13:51 PM12/8/11
to google-map...@googlegroups.com
On 8 December 2011 19:45, thiagohb <thiago...@yahoo.com.br> wrote:
>
> I want know if is possible get an image "with directions" on gif, png or
> jpeg format as the API v1 allows.
> I need a static map that show the shorter way between two markers, the API
> v1 has the option path, but this option connects the two points by a line
> that ignore builds, streets and avenues.

You would need to use the directions API to get the directions (part
of the output is an encoded string of the line of the route) and then
include that encoded string in the URL of your static map.

Bear in mind that the encoded string may push the length of the URL
over the limit for static maps.

http://code.google.com/apis/maps/documentation/directions/
http://code.google.com/apis/maps/documentation/staticmaps/index.html#EncodedPolylines

Rossko

unread,
Dec 8, 2011, 3:15:17 PM12/8/11
to Google Maps JavaScript API v3
> I want know if is possible get an image "with directions" on gif, png or
> jpeg format as the API v1 allows.

v1 ?? Static Maps v1 didn't support Directions directly.

You can write a server side application that gets the route from the
Directions service, extracts the polyline representing the route, and
uses it to construct a Static Map URL ready to insert in your webpage
<img> tag

thiagohb

unread,
Dec 8, 2011, 3:56:29 PM12/8/11
to google-map...@googlegroups.com
Thanks, I'll try yours sugestions.
Reply all
Reply to author
Forward
0 new messages