Hi,
exactly the same problem here. Did you get through this, Matt?
# return color based on value
function getValue(x) {
return x > 7 ? "#800026" :
x > 6.5 ? "#BD0026" :
x > 6 ? "#E31A1C" :
x > 5.5 ? "#FC4E2A" :
x > 5 ? "#FD8D3C" :
x > 4.5 ? "#FEB24C" :
x > 4 ? "#FED976" :
"#FFEDA0";
}
# style function
function style(feature) {
return {
"color": getValue(feature.properties.mag),
"stroke": false
};
}
# adding data from geojson file using style
var dat = L.geoJson(data, {
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, style);
}
});
dat.addTo(map);
This works fine with polygons and lines:
var dat2 = L.geoJson(data2, {
style: style
});
dat.addTo(map);
But points (circles) still have the default style.
It must be possible to style circles dynamically. Anyone knows how?