Search code examples
google-mapsgoogle-maps-static-api

custom marker icon not showing up in static map default red marker only showing in the map..I have used the icon from google drive


I have loaded the custom marker icon from drive.. this is my url:

http://maps.google.com/maps/api/staticmap?center=40.714728,-73.998672&markers=icon:https://drive.google.com/file/d/1_-nl7XFeIUSfJPyhtJjxr_ETYGYKaS_M/view|40.714728,-73.998672&zoom=12&size=400x400&sensor=false

static map with incorrect icon


Solution

  • The URL you are providing for the icon: https://drive.google.com/file/d/1_-nl7XFeIUSfJPyhtJjxr_ETYGYKaS_M/view is not an image (it is a google drive "page").

    If I link to the image on that page: https://lh6.googleusercontent.com/uCOumviUOK9FeSH8d0pg3pW7CSj_-xRYLscegax5LefENROwlIRLzrxezS1U_7jM5MrFVDSJ9d4nKMWcyFak=w1280-h918; it works for me (not sure if that will never change)

    URL: http://maps.google.com/maps/api/staticmap?center=40.714728,-73.998672&markers=icon:https://lh6.googleusercontent.com/uCOumviUOK9FeSH8d0pg3pW7CSj_-xRYLscegax5LefENROwlIRLzrxezS1U_7jM5MrFVDSJ9d4nKMWcyFak=w1280-h918|40.714728,-73.998672&zoom=12&size=400x400

    static map with custom icon