Change icon with loadGeoJson

You may have come across the need to load in map features with the Google Maps API into a map. If you're wanting to change the icon for each point type marker, it may take a while to find how.

Here's a snippet of code to do exactly that. I'm using a custom layer and overriding styles for a particular 'feature'.

var layer = new google.maps.Data();

layer.addListener('addfeature', function(event)
    layer.overrideStyle(event.feature, {
        icon: ''

Show Comments

Get the latest posts delivered right to your inbox.