I'm new to Leaflet and I want to work with attribute based marker icons. I followed a couple of tutorials and can display markers on my screen using geometry data from a PostGIS database.
var mapDataLayer = L.geoJson(geojson, {
pointToLayer: function (feature, latlng) {
var markerStyle = {
fillColor: "#F00",
color: "#FFF",
fillOpacity: 0.5,
opacity: 0.8,
weight: 1,
radius: 8
};
return L.circleMarker(latlng, markerStyle);
},
onEachFeature: function (feature, layer) {
var html = "";
for (prop in feature.properties){
html += prop+": "+feature.properties[prop]+"<br>";
};
layer.bindPopup(html);
}
}).addTo(map);
Using this, I get a couple of points with the same color. Now I want to split up these points using different colors/icons for different attributes.