Public
Edited
Nov 15
7 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
topohelper = import("https://cdn.jsdelivr.net/npm/topohelper@latest/+esm")
Insert cell
Insert cell
Insert cell
world = FileAttachment("world.json").json()
Insert cell
Insert cell
worldtopo = topohelper.fromGeojson(world).topojson
Insert cell
Insert cell
topo = topohelper.from(worldtopo, { deep: true })
Insert cell
Insert cell
Insert cell
topo.view({ tooltip: true, zoom: true })
Insert cell
Insert cell
Insert cell
viewof level = Inputs.range([1, 0], { label: "Level", step: 0.1 })
Insert cell
simplify = topohelper.from(worldtopo, { deep: true }).simplify({ level })
Insert cell
simplify.view({ tooltip: true, zoom: true })
Insert cell
world
Insert cell
Insert cell
geo = topohelper
.from(worldtopo, { deep: true })
// add a layer with continent borders
.innerlines({
layer: 0, // derive from first layer
groupby: "region", // group by a property
name: "region_borders" // new layer name
})
// add a layer with outline of basemap
.outerlines({ layer: 0, name: "outline" })
// add centroids of nuts-3
.centroids({ layer: 0 })
Insert cell
geo.view({ tooltip: true, zoom: true })
Insert cell
Insert cell
Insert cell
arr = geo.toGeojson()
Insert cell
arr[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