Public
Edited
Dec 20, 2022
8 forks
3 stars
Insert cell
Insert cell
map = {
const vx = 0.001, vy = -0.001;
const context = DOM.context2d(width, height);
const path = d3.geoPath(projection, context);
context.canvas.style.width = "100%";
while (true) {
const t = performance.now();
projection.rotate([vx * t, vy * t]);
context.save();
context.beginPath();
projection.precision(0.2);
path(graticule);
context.globalAlpha = 0.1;
context.stroke();
context.beginPath();
projection.precision(0);
path(land);
context.globalAlpha = 1;
context.fill();
context.beginPath();
context.lineWidth = 2;
context.arc(width / 2, height / 2, width / 2 - inset, 0, 2 * Math.PI, false);
context.stroke();
context.restore();
yield context.canvas;
context.clearRect(0, 0, width, height);
}
}
Insert cell
projection = d3.geoOrthographic().fitExtent([[inset, inset], [width - inset, height - inset]], outline)
Insert cell
inset = 20
Insert cell
width = 960
Insert cell
height = 960
Insert cell
outline = ({type: "Sphere"})
Insert cell
graticule = d3.geoGraticule10()
Insert cell
land = topojson.feature(world, world.objects.land)
Insert cell
world = FileAttachment("land-50m.json").json()
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more