Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL for multiple markers in Google Maps

In a desktop Qt application, I have some GPS coordinates that I'd like to show on a map. My plan is to construct an URL with the coordinates and let a web browser and Google maps or a similar service do the heavy lifting.

After reading some apparently reverse-engineered documentation at

mapki.com slash wiki slash Google_Map_Parameters

I can make it work for a single point, but what's the URL syntax for multiple points?

My best shot so far is to build a string such as this:

http://maps.google.com/?ie=UTF8&[email protected],17.82&[email protected],17.82

but that will only show "My Second Point". Is there a better description of the syntax somewhere?


Replacing q= with markers= did not work and the "static map" suggestion below only complained about an incorrect API key.

like image 482
Joakim Rosqvist Avatar asked Nov 20 '09 17:11

Joakim Rosqvist


4 Answers

for google maps static there is this URL:

http://maps.google.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap
&markers=color:blue|label:S|40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318
&markers=color:red|label:C|40.718217,-73.998284&sensor=false&key=MAPS_API_KEY

Detailed version:

http://maps.google.com/maps/api/staticmap?
center=Brooklyn+Bridge,New+York,NY
&zoom=14
&size=512x512
&maptype=roadmap
&markers=color:blue|label:S|40.702147,-74.015794
&markers=color:green|label:G|40.711614,-74.012318
&markers=color:red|label:C|40.718217,-73.998284
&sensor=false
&key=MAPS_API_KEY

i am not sure if this syntax is also good for standard maps

like image 141
dusoft Avatar answered Oct 22 '22 17:10

dusoft


http://staticmapmaker.com/ - very nice web tool for generating static map urls.

List of currently supported map services: - Google - Bing - Yandex - HERE - Mapbox - MapQuest - CartoDB

p.s. I know this is an old question, but many still google for it.

like image 8
cement Avatar answered Oct 22 '22 17:10

cement


Throwing parameters at maps.google.com only gets you one point.

As dusoft says, you could use Google Static maps.

Or, if you require dynamic maps, you could write your own public web page that uses Google Maps API and accepts a long list of parameters. Use your own web page in exactly the same way that you were intending to use maps.google.com web page, except that you get to design what you want the parameters to look like.

Perhaps something like this.

like image 6
Mike Williams Avatar answered Oct 22 '22 18:10

Mike Williams


Several parameters (such as the markers and path parameters) take multiple locations. In those cases, the locations are separated by the pipe (|) character.

https://maps.googleapis.com/maps/api/staticmap?center=boca+raton,+fl+|+deerfied,+FL&zoom=12&scale=false&size=600x300&maptype=roadmap&sensor=false&key=API_KEY&format=png&visual_refresh=true&markers=size:mid%7Ccolor:red%7Cboca+raton,+fl+|+deerfied,+FL" alt="Google Map of boca raton, fl | deerfied, FL
like image 1
Ishai Avrahami Avatar answered Oct 22 '22 18:10

Ishai Avrahami