{
const height = 600;
const canvas = DOM.canvas(width, height);
var context = canvas.getContext("2d");
var path = d3.geoPath(null, context);
context.beginPath();
path(us_states);
context.stroke();
var projection = d3
.geoAlbersUsa()
.scale(1300)
.translate([487.5, 305]);
us_state_capitals.forEach(o => {
var capital = projection([o.longitude, o.latitude]);
context.fillStyle = "red";
context.fillRect(capital[0], capital[1], 5, 5);
});
us_states.features.forEach(o => {
var centroid = path.centroid(o);
var latlon = projection.invert(centroid);
centroid = projection(latlon);
context.fillStyle = "blue";
context.fillRect(centroid[0], centroid[1], 5, 5);
});
return canvas;
}