Public
Edited
Jun 16, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
map = {
const context = DOM.context2d(width, height);
const path = d3.geoPath(projection, context);
context.save();

context.beginPath(),
path(outline),
context.clip(),
(context.fillStyle = backgroundColor),
context.fillRect(0, 0, width, height);

context.beginPath(),
path(land),
(context.fillStyle = landColor),
context.fill();

context.beginPath(),
path(graticule),
(context.strokeStyle = graticuleColor),
context.stroke();

if (showIndicatrix) {
context.beginPath(),
path(circles),
(context.fillStyle = `rgba(243, 156, 18, ${opacity})`),
context.fill();

context.beginPath(),
path(circles),
(context.strokeStyle = `rgba(30, 30, 30, ${opacity})`),
context.stroke();
}

context.restore();
return context.canvas;
}
Insert cell
Insert cell
Insert cell
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
topojson = require("topojson-client@3")
Insert cell
d3 = require("d3-geo@2", "d3-geo-projection@3")
Insert cell
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