Public
Edited
May 13, 2024
Paused
7 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
topohelper.from(topojson, {deep: true})
Insert cell
Insert cell
Insert cell
Insert cell
lines = topohelper.from(topojson, {deep: true})
.lines()
Insert cell
Insert cell
Insert cell
innerlines = topohelper.from(topojson, {deep: true})
.innerlines()
Insert cell
Insert cell
innerlines_2 = topohelper.from(topojson, {deep: true})
.innerlines({groupby: "ADM1_PCODE"})
Insert cell
Insert cell
Insert cell
outerlines = topohelper.from(topojson, {deep: true})
.outerlines()
Insert cell
Insert cell
Insert cell
merge = topohelper.from(topojson, { deep: true }).merge({
groupby: "ADM1_PCODE"
})
Insert cell
Insert cell
Insert cell
filter = topohelper.from(topojson, {deep: true})
// All ADM-2 of Sofia and Sofia City ADM-1
.filter({condition: d => ["BG020", "BG021"].includes(d.properties.ADM1_PCODE)})
Insert cell
Insert cell
Insert cell
centroids = topohelper.from(topojson, {deep: true})
.centroids({better})
Insert cell
Insert cell
Insert cell
Insert cell
simplify = topohelper.from(topojson, {deep: true})
.simplify({level})
Insert cell
Insert cell
Insert cell
Insert cell
properties = topohelper.from(topojson, { deep: true }).properties({
select: ["ADM2_PCODE", "ADM2_EN", "Shape_Area"],
rename: { ADM2_PCODE: "id", ADM2_EN: "name", Shape_Area: "area" },
derive: { area_1000: (d) => d.area * 1000 }
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
fourLayers.view({
layer: form.layer,
zoom: form.zoom,
tooltip: form.tooltip,
size: [form.width, form.width * 0.5]
})
Insert cell
Insert cell
Insert cell
fourLayers.toTopojson()
Insert cell
fourLayers.toTopojson({layer: [0,3]})
Insert cell
Insert cell
fourLayers.toGeojson()
Insert cell
fourLayers.toGeojson({layer: [0,3]})
Insert cell
Insert cell
properties.toObjects()
Insert cell
Insert cell
Insert cell
Insert cell
// Bulgaria administrative level 2
// https://data.humdata.org/dataset/cod-ab-bgr
topojson = FileAttachment("bgr_adm2_2022.json").json()
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