max_
max_

Reputation: 24521

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

Upvotes: 5

Views: 8623

Answers (3)

Tushar Kshirsagar
Tushar Kshirsagar

Reputation: 270

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

Upvotes: 10

bart
bart

Reputation: 15298

You're actually not doing anything wrong, it's Google to blame:

"The Google Static Maps API does not support custom icon URLs that use HTTPS"

Upvotes: 2

Shortys Oberto Dutari
Shortys Oberto Dutari

Reputation: 556

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

Upvotes: 19

Related Questions