So I am making a Leaflet map. I am using a json which lists countries as Latlng points, and their corresponding attribute (called CTH values). I am trying to use this value to set the area of circle markers on these Latlng points to be proportional to the CTH value, but I am struggling to figure out how.
This is what I've written
function addCTHValueMarkers () {
CTHValueLayer = L.geoJSON(CTHValue, {
pointToLayer: function (feature, latlng) {
return new L.circleMarker(latlng, {
fillOpacity: 0.6,
radius: setRadius(feature.properties.CTHValue)
})
}
});
CTHValueLayer.addTo(map);
}
I was originally going to use the radius but I need area to make them actually proportional, can someone show me how I set the area? Do I make a seperate function to work out area, then pass this to the radius? How do I do this?
Whenever I try to refer to (feature.properties.CTHValue) outside of the CTHValueLayer = L.geojson(CTHValue { }) argument it doesn't work, can someone show me how I can access the CTH Value from within my geojson in a seperate function, so I can pass the CTHValue to an area calculation