Reputation: 41
This is probably quite simple, but I am struggling to work it out. I am trying to place a custom marker using lat/lng
https://maps.googleapis.com/maps/api/staticmap?size=600x400&scale=2&markers=icon:http://chart.googleapis.com/chart?chst=d_bubble_texts_big&chld=bb%7Cffffff%7C000000%7CPL1+2|50.367285472963,-4.138801595¢er=50.367285472963,-4.138801595&zoom=10
but it does not show the marker - what am I missing?
The marker works:
http://chart.googleapis.com/chart?chst=d_bubble_texts_big&chld=bb%7Cffffff%7C000000%7CPL1+2
As does the map with a default marker
markers=color:red|50.367285472963,-4.138801595¢er=50.367285472963,-4.138801595&zoom=10
Upvotes: 3
Views: 4594
Reputation: 3461
When using custom markers, the icon:
parameter should be URL-encoded.
As your icon is from a deprecated API as stated at the Dynamic Icons Reference, I will use another custom image as big as possible, that is, as stated by Dr.Molle and the Google Static Maps Reference
Icons are limited to sizes of 4096 pixels (64x64 for square images)
Consider my initial marker (a Catalonian tradition in Nativity manger) : https://png.icons8.com/ios/40/000000/full-of-shit.png
I suggest also to shorten it with goo.gl and then URL encode it (could be done online at http://meyerweb.com/eric/tools/dencoder/) resulting in: https%3A%2F%2Fpng.icons8.com%2Fios%2F40%2F000000%2Ffull-of-shit.png
, so the final request should look like https://maps.googleapis.com/maps/api/staticmap?size=600x400&scale=2&markers=icon:shortenedURL-Encoded|50.367285472963,-4.138801595¢er=50.367285472963,-4.138801595&zoom=10
As StackOverflow "suggests" to avoid shorteners, here is the version without shortener:
Upvotes: 4