{
const container = yield htl.html`<div style="height: 800px">`;
const map = L.map(container).setView([40.7678, -73.9645], 13);
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: "© <a href=https://www.openstreetmap.org/copyright>OpenStreetMap</a> contributors"
}).addTo(map);
const nyBlockLayer = L.geoJSON(null).addTo(map);
nyBlockLayer.addData(nyBlockPop);
nyBlockLayer.getLayers().forEach( l => {
if(l.feature.properties.TotalPop > minPop) {
nyBlockLayer.resetStyle(l);
l.on('mouseover', e => {
l.setStyle({fillColor:'red', fillOpacity: 1.0});
}).on('mouseout', e=> {
nyBlockLayer.resetStyle(l);
});
} else {
l.setStyle({fillColor: 'red', fillOpacity: 0.0, opacity: 0.0});
}
});
map.on('dblclick', e => {
map.zoomOut(1);
});
map.on('keydown keypress', e => {
let keyVal = e.originalEvent.key;
if(keyVal === 'h' || keyVal === 'H') {
map.setView([40.7678, -73.9645], 18);
}
});
}