map = {
const width = 1500,
height = 1200;
const scale0 = projection.scale(),
translate0 = projection.translate(),
context = DOM.context2d(width, width, 2),
path = d3.geoPath(projection).context(context);
projection.fitExtent([[0, 0], [width, width]], route);
context.beginPath();
context.fillStyle = "rgba(255, 255, 255, 0.5)";
context.fill();
context.strokeStyle = "#222";
context.stroke();
route.features.forEach(r => {
context.beginPath();
path(r);
context.lineWidth = 2;
context.strokeStyle = r.properties.color;
context.stroke();
});
context.canvas.setAttribute("id", "map");
projection.scale(scale0).translate(translate0);
context.canvas.style = "width:100%; height:auto";
return context.canvas;
}