Sandy
Sandy

Reputation: 323

Markers are not shown in static google map

I am having google static map url this way with multiple markers.

https://maps.googleapis.com/maps/api/staticmap?size=1100x795&markers=color:red|label:S|45.459041,-98.430198&markers=color:red|label:S|45.469042,-98.430199&markers=color:red%7Clabel:S%7C40.702147,-74.015794&markers=color:red%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284

But in the map only 2 markers are shown.

static map from URL above

I have even tried adding these parameters in the url but still it showing only 2 markers in my map.

  &maptype=roadmap
    &sensor=fasle

What is the mistake here? can some one help me?

Thanks

Upvotes: 3

Views: 2579

Answers (1)

gerardnimo
gerardnimo

Reputation: 1454

It is because of the distance of the markers. The first two markers are near each other and the other three is also near each other, but the first two markers are relatively far from the latter three. I tried getting the Static maps separately and making separate requests for the first two and the latter three and it displays the markers accordingly. I guess because of the distance the markers overlapped.

fiddle of Google Maps Javascript API v3 map showing the same markers (navigate to the markers to see what is happening)

Request for the first two:

https://maps.googleapis.com/maps/api/staticmap?size=1100x795&markers=color:red|label:S|45.459041,-98.430198&markers=color:red|label:S|45.469042,-98.430199

enter image description here

Request for the latter three:

https://maps.googleapis.com/maps/api/staticmap?size=1100x795&markers=color:red%7Clabel:S%7C40.702147,-74.015794&markers=color:red%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284

enter image description here

Upvotes: 3

Related Questions