Platform
Resources
Pricing
Sign in
Get started
jgaffuri
GIS and cartography at Eurostat
Workspace
Fork
Public
By
jgaffuri
Edited
May 4, 2024
MIT
Fork of
Hello gridviz
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
map
=
new
g
.
Map
(
container
,
{
x
:
4500000
,
y
:
2900000
,
z
:
3000
}
)
.
addZoomButtons
(
)
Insert cell
dataset
=
new
g
.
MultiResolutionDataset
(
[
1000
,
2000
,
5000
,
10000
,
20000
,
50000
,
100000
]
,
(
resolution
)
=>
new
g
.
TiledGrid
(
map
,
"https://raw.githubusercontent.com/jgaffuri/tiled-grid-lucas/main/out/"
+
resolution
+
"m/"
)
)
Insert cell
colorScale
=
d3
.
interpolatePuBuGn
//interpolateRdPu //interpolateYlGnBu //interpolateYlOrRd
Insert cell
style
=
new
g
.
ShapeColorSizeStyle
(
{
color
:
(
cell
,
resolution
,
z
,
[
min
,
max
]
)
=>
colorScale
(
cell
.
COUNT_POINT_ID
/
max
)
,
viewScale
:
(
cells
)
=>
d3
.
extent
(
cells
,
(
cell
)
=>
+
cell
.
COUNT_POINT_ID
)
}
)
Insert cell
layer
=
new
g
.
GridLayer
(
dataset
,
[
style
]
,
{
minPixelsPerCell
:
2
,
cellInfoHTML
:
(
c
,
resolution
)
=>
"Number of visits: "
+
c
.
COUNT_POINT_ID
+
"<br>(per "
+
d3
.
format
(
",.2r"
)
(
resolution
*
resolution
*
1e-6
)
+
" km²)"
}
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
map
.
layers
=
[
backgroundLayer1
,
backgroundLayer2
,
layer
,
boundariesLayer
,
labelLayer
]
;
}
Insert cell
{
backgroundLayer1
.
visible
=
(
z
)
=>
showBackground
&&
z
>=
50
;
backgroundLayer2
.
visible
=
(
z
)
=>
showBackground
&&
z
<
50
;
boundariesLayer
.
visible
=
(
)
=>
showBoundaries
;
labelLayer
.
visible
=
(
)
=>
showLabels
;
map
.
redraw
(
)
;
}
Insert cell
g
=
require
(
"gridviz@3.0.7"
)
Insert cell
ges
=
require
(
"gridviz-eurostat@2.0.0"
)
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
Compare fork
Fork
View
Export
container
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
showBackground
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
showBoundaries
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
showLabels
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
map
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
dataset
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
colorScale
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
style
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
layer
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
backgroundLayer1
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
backgroundLayer2
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
boundariesLayer
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
labelLayer
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
g
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
ges
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML