Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add marker to center of static google map

Tags:

google-maps

It is very simple to create a google map and center on a given location (see below). It is also similarity simple to create a google map and show markers on it by doing something like markers=color:blue%7Clabel:S%7C11211%7C11206%7C11222.

How would I just create a simple centered map like the below, but add a single marker in the very center? Thanks

<img alt="Map" src="http://maps.google.com/maps/api/staticmap?center=+AUBURN+WA+98001&amp;zoom=14&amp;size=400x400&amp;sensor=false">
like image 861
user1032531 Avatar asked Jan 03 '13 14:01

user1032531


People also ask

How do I create a custom marker on Google Maps?

For adding a custom marker to Google Maps navigate to the app > res > drawable > Right-Click on it > New > Vector Assets and select the icon which we have to show on your Map. You can change the color according to our requirements. After creating this icon now we will move towards adding this marker to our Map.


2 Answers

I guess that the map automatically will fit to show the specified markers, here you will find

Marker Locations

Each marker descriptor must contain a set of one or more locations defining where to place the marker on the map. These locations may be either specified as latitude/longitude values or as addresses. These locations are separated using the pipe character (|).

The location parameters define the marker's location on the map. If the location is off the map, that marker will not appear in the constructed image provided that center and zoom parameters are supplied. However, if these parameters are not supplied, the Static Map server will automatically construct an image which contains the supplied markers. (See Implicit Positioning below.)

like image 149
Victor Avatar answered Oct 02 '22 18:10

Victor


You could also add your own centered background image ontop if the map :)

background: url('yourmarker.png' ) center no-repeat, url(http://maps.google.com/maps/api/staticmap?center=AUBURN+WA+98001&zoom=14&amp&size=400x400);
like image 39
user1087110 Avatar answered Oct 02 '22 19:10

user1087110