google-mapsgoogle-maps-static-api

Google static map not showing more than 5 pins


I tried everything but whatever I do static Google map is now showing more than 5 pins. My static map URL is https://maps.googleapis.com/maps/api/staticmap?center=43.508708883,16.439189110&zoom=7&size=640x320&key=MY_API_KEY&markers=icon:http://test2018.adriagate.com/images/pin-number-icon-1.png?v=7|43.508708,16.439189&markers=icon:http://test2018.adriagate.com/images/pin-number-icon-2.png?v=7|43.172360,16.441608&markers=icon:http://test2018.adriagate.com/images/pin-number-icon-3.png?v=7|42.787800,17.345000&markers=icon:http://test2018.adriagate.com/images/pin-number-icon-4.png?v=7|42.650600,18.091400&markers=icon:http://test2018.adriagate.com/images/pin-number-icon-5.png?v=7|42.958300,17.134400&markers=icon:http://test2018.adriagate.com/images/pin-number-icon-6.png?v=7|43.296700,17.017800&markers=icon:http://test2018.adriagate.com/images/pin-number-icon-7.png?v=7|43.444400,16.688300&markers=icon:http://test2018.adriagate.com/images/pin-number-icon-8.png?v=7|43.508708,16.439189

It seems it is short enough because limit is 2048 characters. It has only 8 pins. There is only limit is markers if it has adress instead of latitude and longitude.

I lost few hours and whatever I do it is not showing pin 6 7 and 8. Yes, they exist on server as you can see: http://test2018.adriagate.com/images/pin-number-icon-8.png


Solution

  • This is a documented behavior of Static Maps API.

    Have a look at this page https://developers.google.com/maps/documentation/maps-static/dev-guide#Markers

    There is the following statement

    You can use up to five unique custom icons per request. This limitation does not mean that you are limited to only 5 marked locations on your map. Each unique icon may be used with more than one markers location on your map.

    There was also feature request in Google issue tracker to allow more than 5 unique icons: https://issuetracker.google.com/issues/35825584

    However, Google marked this feature request as duplicated in favor of another feature request regarding KML layers in static maps:

    https://issuetracker.google.com/issues/35817020

    Feel free to star the feature request to express your interest.

    I hope my answer clarifies your doubt.