问题
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 radius of circle markers on these Latlng points, 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 tried to make a seperate SetRadius function, as you can see referenced above, but I don't quite know what to put inside. I just want the radius to set as the CTHValue / some function of the CTH value. How should I do this?
来源:https://stackoverflow.com/questions/59401891/how-to-set-the-radius-of-a-circle-marker-to-be-proportional-to-an-attribute-valu