Public
Edited
May 22, 2023
Insert cell
Insert cell
Insert cell
Insert cell
{
const w = width;
const h = 600;
const ctx = DOM.context2d(w, h);

ctx.lineJoin = "round";
ctx.lineCap = "round";
ctx.lineWidth = 0.5

const projection = d3.geoMercator()
.fitSize([w, h], mass_towns);

const path = d3.geoPath(projection, ctx);

for(let feature of mass_towns.features) {
ctx.beginPath();
path(feature);
ctx.stroke();
}

return ctx.canvas;
}
Insert cell
{
const w = width;
const h = 600;
const ctx = DOM.context2d(w, h);

ctx.lineJoin = "round";
ctx.lineCap = "round";
ctx.lineWidth = 0.5

const projection = d3.geoMercator()
.fitSize([w, h], boston_neighborhoods);

const path = d3.geoPath(projection, ctx);

for(let feature of boston_neighborhoods.features) {
ctx.beginPath();
path(feature);
ctx.stroke();
}

return ctx.canvas;
}
Insert cell
turf = require("@turf/turf")
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