Search code examples
google-mapsgoogle-maps-markers

How to set a default marker to the location based lat and long in google map received by Google Static API?


I want google map image with default marker like below. enter image description here

But, It is coming naked with marker. Click below link

https://maps.googleapis.com/maps/api/staticmap?center=28.6086154,77.3566754&zoom=14&markers=color:blue&size=500x250&key=YOUR_API_KEY

enter image description here

How can I set marker same as previous photo??


Solution

  • You can set the color of the marker to red, plus add the marker location at the end. Here’s a Static Map API web request for reference:

    https://maps.googleapis.com/maps/api/staticmap?center=28.6086154,77.3566754&zoom=14&size=500x250&maptype=roadmap&markers=color:red%7C28.6086154,77.3566754&key=YOUR_API_KEY
    

    More info can be found here: