viewof CrimePoints = {
let width = 900;
let height = 400;
let container = DOM.element("div", {
style: `width:${width}px;height:${width / 2}px`
});
yield container;
let setCatClr = function(cn) {
let i=0;
for (i=0;i< OffenseCatClr.length; i++){
if (cn === OffenseCatClr[i].Oname){
return OffenseCatClr[i].CClr
}
}
return(null)
}
let map = L.map(container, { maxZoom: 16, minZoom: 12 });
let osmLayer = L.tileLayer(
"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}@2x.png",
{
attribution:
'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
opacity:1
}
).addTo(map);
let VanAreasLayer = L.geoJson(vanAreas, {
weight: 2,
color: "#432",
fillColor: "#EEE",
fillOpacity: 0,
opacity: 1,
onEachFeature: areaClick
})
.bindPopup(function (Layer) {
return Layer.feature.properties.NAME;
})
.addTo(map);
let vCrimeLayer2 = L.geoJSON(FilteredGeoCrimes, {
style: function(feature) {
return {
color: setCatClr(feature.properties.Offense)
};
},
pointToLayer: function(feature, latlng) {
return new L.CircleMarker(latlng, {
radius: 3,
fillOpacity: 0.1,
fillColor: setCatClr("purple"),
Opacity: 0.1
});
},onEachFeature: function (feature, layer) {
layer.bindPopup(feature.properties.Offense);
}
});
map.addLayer(vCrimeLayer2);
map.on("click", () => (mutable nHood = null));
map.fitBounds(VanAreasLayer.getBounds());
}