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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more