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

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