Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a custom image marker on google static map?

how to have custom image marker on google static map, i need url format:

this is what i have tried, but its having default marker image http://maps.google.com/maps/api/staticmap?center=25.3176452,82.97391440000001,&zoom=15&markers=25.3176452,82.97391440000001|25.3176452,82.97391440000001&path=color:0x0000FF80|weight:5|25.3176452,82.97391440000001&size=175x175&sensor=TRUE_OR_FALSE

like image 325
praveenraj Avatar asked Feb 13 '15 04:02

praveenraj


People also ask

Can I put a marker on Google Maps?

You can now pinpoint locations manually by clicking the marker icon and placing it directly onto the map, or search for locations using the search box at the top of the screen. If you're adding locations manually, you can name the location and save to add it to the map.

How do I start a custom image on Google Maps marker for mobile app?

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

This is what you want:

http://maps.googleapis.com/maps/api/staticmap?zoom=17&size=512x512&maptype=hybrid&markers=icon:http://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico|34.052230,-118.243680

for a custom image, put the icon:url after of markers...

Format

icon:url|lat,lng 

Example

icon:http://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico|34.052230,-118.243680 

a result of my example

stackoverflow server ubication...

For more information check google maps api, there are more information like size, markers position, center map, map type... etc.

https://developers.google.com/maps/documentation/static-maps/intro#MapTypes

*If the icon, img, don't appear it will be the size of image, try with another size,less than 64x64 px, format of image, "GIF, JPEG and PNG", the documentation recommend "PNG", if it doesn't appear check permision of image for public request(external request)...

like image 123
DarckBlezzer Avatar answered Sep 30 '22 22:09

DarckBlezzer


According to the documentation you can specify custom icons like so:

markers=icon:...

e.g. amending your URL:

http://maps.google.com/maps/api/staticmap?center=25.3176452,82.97391440000001,&zoom=15&markers=icon:http://www.megaadresse.com/images/icons/google-maps.png|25.3176452,82.97391440000001&path=color:0x0000FF80|weight:5|25.3176452,82.97391440000001&size=175x175

Gives you:

enter image description here

PS: the sensor parameter is no longer required.

PPS: also you seemed to have specified the same coordinates twice in your markers parameter, so it was actually drawing two markers on the same location.

like image 42
duncan Avatar answered Sep 30 '22 23:09

duncan