function createMap() {
const height = Math.round(Math.min(500, width * 0.7));
const projection = d3
.geoOrthographic()
.fitSize([width, height], { type: "Sphere" });
const context = DOM.context2d(width, height);
const path = d3.geoPath(projection, context);
function update(points, r) {
const pts = {
type: "MultiPoint",
coordinates: points.filter((d) => !d.ignore)
};
context.clearRect(0, 0, width, height);
context.beginPath();
projection.reflectX(true).rotate([r[0] + 180, -r[1], -r[2]]);
path.pointRadius(0.5);
path(pts);
context.fill();
context.beginPath();
projection.reflectX(false).rotate(r);
path.pointRadius(1.4);
path(pts);
context.fill();
}
context.canvas.update = update;
return context.canvas;
}