Platform
Solutions
Resources
Pricing
Sign in
Sign up
Thomas Ansart
Cartography and datavisualization at Sciences Po
Workspace
Fork
Public
Topohelper
By
Thomas Ansart
Edited
May 13, 2024
Paused
7 stars
1
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
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
lines
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
innerlines
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
innerlines_2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
outerlines
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
merge
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
filter
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
centroids
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
better
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
simplify
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
level
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
properties
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
fourLayers
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
form
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
topohelper
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
topojson
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML