I want to use different icons based on attibute values 'art' in a Google Maps data.layer. I've defined an customIcons object with all the styling options I need.
var customIcons = {
Ap: {
icon: './images/pin_green.png'
},
Bi: {
icon: './images/pin_yellow.png'
},
Wa: {
icon: './images/pin_brown.png'
}
};
When I try to use this object in a style function, I get an error: "a.url.substr is not a function"
map.data.setStyle( function(feature){
var art = feature.getProperty('art');
var icons = customIcons[art] || {};
return {
icon: icons
}
});
When I use a single icon, passing the url like
icon: {url: './images/pin_green.png'}
it works, but all points use the same icon. I've tried already a lot, but I cannot get the right syntax.