Search code examples
google-mapsmapsgoogle-maps-markersagm-map

Google Maps API: Unable to Generate Custom Map Pins using "chart.apis.google.com"


I'm currently working on a project where I need to customize map pins for markers in Google Maps API. I've been using the URL format provided by Google Maps API to generate custom map pins dynamically, but it seems that the URL https://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=L|1e90ff|000000 is not working anymore.

Could someone please clarify if this feature has been deprecated or if there's an alternative method to achieve custom map pins with Google Maps API?

Thank you in advance for any insights or suggestions!


Solution

  • Just been hit by this today too. Our workaround was to use svg:

    var icon = {
        path: "M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0",
        fillColor: "#FFCC00",
        fillOpacity: 1,
        anchor: new google.maps.Point(0, 0),
        strokeWeight: 1,
        scale: 0.5
    }
    
    var marker = new google.maps.Marker({
        position: loclatlong[i],
        map: map,
        icon: icon
    });