Platform
Resources
Pricing
Sign in
Get started
Atelier de cartographie de Sciences Po
Workspace
Fork
Public
Graticule
By
Thomas Ansart
Edited
May 25, 2022
MIT
3 stars
1
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
land
=
topojson
.
merge
(
countries_simplified
,
countries_simplified
.
objects
.
countries_110m
.
geometries
)
Insert cell
Insert cell
Insert cell
ocean
=
{
const
c
=
land
.
coordinates
.
slice
(
)
.
sort
(
(
[
a
]
,
[
b
]
)
=>
b
.
length
-
a
.
length
)
;
return
{
type
:
"MultiPolygon"
,
coordinates
:
[
c
.
map
(
(
[
outerRing
]
)
=>
outerRing
.
slice
(
)
.
reverse
(
)
)
,
c
.
flatMap
(
(
[
,
...
holes
]
)
=>
holes
.
map
(
(
r
)
=>
r
.
slice
(
)
.
reverse
(
)
)
)
]
}
;
}
Insert cell
Insert cell
Insert cell
oceanRewind
=
turf
.
rewind
(
land
,
{
reverse
:
false
}
)
// 👎 Ne fonctionne pas
Insert cell
Insert cell
Insert cell
sphere
=
(
{
"type"
:
"Polygon"
,
"coordinates"
:
[
[
[
-
180
,
-
90
]
,
[
-
180
,
90
]
,
[
180
,
90
]
,
[
180
,
-
90
]
,
[
-
180
,
-
90
]
]
]
}
)
Insert cell
// /!\ return geojson RFC 7946 compatible
oceanDiff
=
(
{
"type"
:
"MultiPolygon"
,
"coordinates"
:
clip
.
difference
(
sphere
.
coordinates
,
land
.
coordinates
)
}
)
Insert cell
Insert cell
Insert cell
oceanDiffRewind
=
turf
.
rewind
(
oceanDiff
,
{
reverse
:
true
}
)
Insert cell
Insert cell
Insert cell
Insert cell
projection
=
d3
.
geoEqualEarth
(
)
.
rotate
(
[
-
150
,
0
]
)
Insert cell
path
=
d3
.
geoPath
(
projection
)
Insert cell
Insert cell
height
=
{
const
[
[
x0
,
y0
]
,
[
x1
,
y1
]
]
=
d3
.
geoPath
(
projection
.
fitWidth
(
width
,
outline
)
)
.
bounds
(
outline
)
const
dy
=
Math
.
ceil
(
y1
-
y0
)
return
dy
;
}
Insert cell
outline
=
(
{
type
:
"Sphere"
}
)
Insert cell
Insert cell
Insert cell
turf
=
require
(
"@turf/turf"
)
Insert cell
clip
=
require
(
"polygon-clipping@0.15.3"
)
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.
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
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
land
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
ocean
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
oceanRewind
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
sphere
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
oceanDiff
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
oceanDiffRewind
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
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
projection
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
path
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
width
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
height
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
outline
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
turf
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
clip
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML