I am trying to populate popups on each polygon and style the layer according to type of commodity. Popups are empty and style doesn't work.
Code shown below:
lyrlicences = new L.GeoJSON.AJAX('data/Tzlicences.geojson',{style:stylePolygons, onEachFeature:returnPolygons}).addTo(tzmap);
function stylePolygons(json){
var att = json.properties;
if(att.commoditie =='Gold'){
return {color: 'yellow', weight:3}
}
if(att.commoditie =='Copper'){
return {color: 'brown', weight:3}
}
else {
return {color: 'red', weight:5}
}
}
function returnPolygons(json, layer){
layer.bindPopup(json.properties.commoditie);
}