Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create message bubble and path on Google static maps

I am trying to create a static map url using google maps api which looks similar to following

enter image description here

It seems like I require to increase the zoom levels and add a path parameter to the url. I have tried to create url like following

http://maps.googleapis.com/maps/api/staticmap?scale=4&format=png32&center=50.133751,4.833644&zoom=16&size=640x640&markers=color:red%7C50.133751,4.833644&sensor=false&path=color:blue|48.133751,4.833644|50.133751,4.833644&style=feature:road.local

But it is not giving required results, I need to create dynamic urls based on the addresses and lat/lng values provided. I somehow requires to rotate map in such a way so that it always have a vertical road in the middle so that I can draw a path over it. Additionally, I need a bubble which will show a fixed time to reach say 5/1 min.

I am not using any programming language as of now. I am trying to create these urls manually.

Thanks in advance.

EDIT : I don't need to rotate it now. Just wants to show a 1-5 min directions to the given latitude/longtitude/address value and for message bubble, I have created a static image which I can show as an overlay.

like image 372
Saurabh Saxena Avatar asked Dec 03 '14 18:12

Saurabh Saxena


1 Answers

Based on your specific needs to show a path and a time from 1 to 5 minutes I would recommend the following:

First of all you need to know that you have two possibilites concerning the label

  1. Use the standard marker and add a label with a length of 1 and [A-Z], [0-9] (so just the time in your case...one to five)
  2. Use a custom icon which already includes the label (in your case this is a option because you just have to create five images containing "2 min" or something)

For the first option I would take the center of two connected points and add a white marker with the label of the route duration like markers=color:white|label:1|52,5210924,13,39181335. Then you will have a white standard marker on your route like this.

For the second option you can change the marker position away from the path (depending on how your label image looks like) and add the image with the correct duration (1.png, 2.png, 3.png,...) like markers=icon:https//your.path/to/image.png|52,5210924,13,39228335. Like this you can include your own image, which would look like this (sorry for the bad image ;-)).

Adding a custom marker icon with a label (in the URL) is sadly not possible.

I think in your case (also when creating it manually) it would be fine to create 5 bubble images and add those as described to your static map. The faster and easier (but not so good looking) way would be the first option, because you could place it right on the path and don't have to create the bubble images.

like image 146
mxlse Avatar answered Oct 11 '22 14:10

mxlse