Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Marker Icon not showing Google Static Maps v2

I am using the Static Google Maps API v2 to download a static image of a map view with a singular marker just showing one image. However, the image added to the marker parameter of the url doesn't seem to be making any difference, and just a red marker is shown at the location.

Please can you tell me where I am going wrong?

http://maps.googleapis.com/maps/api/staticmap
?center=37.446754,-77.572746
&size=70x61
&maptype=roadmap
&sensor=true
&scale=2
&zoom=15
&key=some_key
&markers=icon:https://foursquare.com/img/categories_v2/shops/financial_bg_64.png|37.446754,-77.572746
like image 900
max_ Avatar asked Sep 07 '12 20:09

max_


People also ask

How do you change the color of a marker on Google Maps?

To edit the marker color, click or tap on the marker icon. When you do that, you can change both the color of the marker and its style. Go for the color or style you want to change and then click OK to see the effect. Click on the button labeled Done to save your new marker color settings.

How do you refresh a marker on Google Maps?

To reload the markers, when you create then, push them to an array. Then create a function where you iterate through the array, setting the markers map as null. After this, erase the array.


2 Answers

your image URL must remove the letter S HTTPS secure site, so work, for example like this:

http://foursquare.com/img/categories_v2/shops/financial_bg_64.png

complete code:

http://maps.googleapis.com/maps/api/staticmap?
center=37.446754,-77.572746&size=70x61&maptype=roadmap&sensor=false
&scale=2&zoom=15
&markers=icon:http://foursquare.com/img/categories_v2/shops/financial_bg_64.png|37.446754,-77.572746
like image 76
Shortys Oberto Dutari Avatar answered Sep 28 '22 11:09

Shortys Oberto Dutari


In my experience, There is no such requirement of http or https just care for icon size . icon size should not exceed more than 64X64 pixels in size , Static map will happily show the custom icon . accept if found correct @max_

http://maps.googleapis.com/maps/api/staticmap?
center=37.446754,-77.572746&size=70x61&maptype=roadmap&sensor=false
&scale=2&zoom=15
&markers=icon:http://foursquare.com/img/categories_v2/shops/financial_64X64.png|37.446754,-77.572746

off course use your image with below 64X64 dimension instead of

http://foursquare.com/img/categories_v2/shops/financial_64X64.png
like image 44
Tushar Kshirsagar Avatar answered Sep 28 '22 09:09

Tushar Kshirsagar