1

I want to generate a static maps image using google's static-maps API. My requirement is to display as many markers as many stops are there.

For example if my route has three stops First S1 than S2 and last S3; than three markers should be shown and path should be draw among them.

I am adding three markers as shown below :

&markers=icon:https://assets.com/img/markers/start.png%7C17.422024%2C78.338294

But I am getting markers at start position S1 and last position S3. Path is getting drawn correctly. Can anybody help why I am not getting the middle marker in static maps API?

Tarun Deep Attri
  • 8,174
  • 8
  • 41
  • 56
  • refer this link [click here](https://stackoverflow.com/questions/1771879/url-for-multiple-markers-in-google-maps) may be this link will help you – Prashant Jajal Dec 26 '17 at 06:53
  • Thanks for your input. But on google maps I can add multiple markers. This question is about static maps with route drawn. Static maps API is used to generate Image for your route with markers and other options. On Route I wanted to add markers on all the stops using static maps API to generate route Image. – Tarun Deep Attri Dec 26 '17 at 06:55
  • you have to add waypoints in URL :) – Subhash Prajapati Dec 26 '17 at 07:17

1 Answers1

0

I got the answer to this question myself. Thing is you can as many markers as many you want. Just Coordinates of the marker needs to be unique.

In my case co-ordinates of some points were same, hence markers were getting overridden.

We can add multiple markers by adding following line with unique latitude and longitude multiple times :

&markers=icon:https://assets.com/img/markers/start.png%7C17.422024%2C78.338294
&markers=icon:https://assets.com/img/markers/start.png%7C17.422024%2C78.338294
&markers=icon:https://assets.com/img/markers/start.png%7C17.422024%2C78.338294
... so on
Tarun Deep Attri
  • 8,174
  • 8
  • 41
  • 56