Published
Edited
Jul 21, 2021
4 forks
23 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
countries = topojson.feature(world, world.objects.world_countries_data)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
squares = {
let r = squaregrid(mystep);
r.forEach((e) => {
const center = d3.polygonCentroid(e.geometry.coordinates[0]);
const geoCenter = projection.invert(center);
//r.push(
Object.assign(e, {
test: d3.geoContains(land, geoCenter)
});
//);
});
return r;
}
Insert cell
triangles = {
let r = trianglegrid(mystep);
r.forEach((e) => {
const center = d3.polygonCentroid(e.geometry.coordinates[0]);
const geoCenter = projection.invert(center);
//r.push(
Object.assign(e, {
test: d3.geoContains(land, geoCenter)
});
//);
});
return r;
}
Insert cell
r = hexgrid(mystep)
Insert cell
e = r[100]
Insert cell
d3.polygonCentroid(e.geometry.coordinates[0]);
Insert cell
r2 = trianglegrid(mystep)
Insert cell
e2 = r2[100]
Insert cell
d3.polygonCentroid(e2.geometry.coordinates[0])
Insert cell
hexagons = {
let r = hexgrid(mystep);
r.forEach((e) => {
const center = d3.polygonCentroid(e.geometry.coordinates[0]);
const geoCenter = projection.invert(center);
//r.push(
Object.assign(e, {
test: d3.geoContains(land, geoCenter)
});
//);
});
return r;
}
Insert cell
random = {
let r = voronoigrid(mystep);
r.forEach((e) => {
const center = d3.polygonCentroid(e.geometry.coordinates[0]);
const geoCenter = projection.invert(center);
// r.push(
Object.assign(e, {
test: d3.geoContains(land, geoCenter)
});
//);
});
return r;
}
Insert cell
Insert cell
import { Range, Radio } from "@observablehq/inputs"
Insert cell
Insert cell
d3 = require("d3@6", "d3-geo-projection@2")
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