map = {
const div = d3.select(html`<div>`);
const context = DOM.context2d(width, height);
const canvas = context.canvas;
const scale = width / mapWidth;
context.scale(scale, scale);
div.append(() => canvas)
const path = d3.geoPath(projection);
div.style('position', 'relative')
.style('width', '100%')
.style('height', height + 'px')
.append(() => states)
.style("position", "absolute")
.style("top", 0)
.style("left", 0)
.selectAll("path.interior")
.style("fill", "none")
.style("stroke", "none");
const map = d3.select(states);
map.selectAll('path.nation')
.style('stroke', '#333')
map.selectAll("path.mesh")
.style("fill", "none")
.style("stroke", "#aaa");
const bwi = [-76.6684, 39.1774];
map.append('path')
.attr('d', path({"type": "Point", "coordinates": bwi }))
.attr('fill', 'steelblue');
const newark = [-74.1745, 40.6895];
map.append('path')
.attr('d', path({"type": "Point", "coordinates": newark }))
.attr('fill', 'steelblue');
map.selectAll("path.pirep")
.data(pireps)
.join("path")
.classed('pirep', true)
.attr("x", (d, i) => i * 16)
.attr("d", d => path({"type": "Point", "coordinates": d}))
.attr('fill', d => colors[d[3]])
.attr('fill-opacity', 0.5)
.on('mouseover', function(d) { if (d[4]) mutable z = d[4]; d3.select(this).attr('stroke', 'black') })
.on('mouseout', function() { mutable z = "Mouse over the map for pilot reports"; d3.select(this).attr('stroke', null) })
invalidation.then(() => div.remove());
yield div.node();
}