treeMap = {
let container = DOM.element("div", {
style: `width:${width}px;height:${width / 2}px`
});
yield container;
let map = L.map(container).setView([35.785644, -78.654006], 17);
let toner = L.tileLayer(
"https://tiles.stadiamaps.com/tiles/stamen_toner_lite/{z}/{x}/{y}{r}.{ext}",
{
minZoom: 0,
maxNativeZoom: 20,
attribution:
'© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a> © <a href="https://www.stamen.com/" target="_blank">Stamen Design</a> © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
ext: "png",
maxZoom: 22
}
).addTo(map);
function getColor(d) {
return d == conditions[0]
? colors[3]
: d == conditions[1]
? colors[4]
: d == conditions[2]
? colors[2]
: d == conditions[3]
? colors[0]
: d == conditions[4]
? colors[1]
: "#000000";
}
function onEachFeature(feature, layer) {
layer.bindPopup(feature.properties.COMMON_NAME);
}
let treesLayer = L.geoJSON(trees, {
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, {
radius: 6,
color: "#fff",
fillColor: getColor(feature.properties.CONDITION),
weight: 1,
opacity: 1,
fillOpacity: 0.75
});
},
onEachFeature: onEachFeature
}).addTo(map);
}