{
const context = DOM.context2d(width, width * (rows / cols)),
path = d3.geoPath(projection, context);
const dx = width / cols,
dy = dx;
let i = 0;
for (const country of countries.features) {
const x = i % cols,
y = Math.floor(i / cols);
projection
.rotate(d3.geoCentroid(country).map(d => -d))
.fitExtent(
[[x * dx, y * dy], [(x + 0.95) * dx, (y + 0.95) * dy]],
country
);
context.beginPath();
path(country);
context.fillStyle = "#aaa";
context.fill();
context.fillStyle = "#000";
context.fillText(
country.properties.name.substring(0, 13),
x * dx,
(y + 0.9) * dy
);
i++;
}
yield context.canvas;
}