0

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); }

TomazicM
  • 25,601
  • 22
  • 29
  • 39
Lawi
  • 1
  • 1

0 Answers0