Platform
Resources
Pricing
Sign in
Get started
Brett Cooper
In New Zealand being kid of human. We might make mistakes but we will make other things too. - Michael Joseph Savage
Workspace
Fork
Published
By
Brett Cooper
Edited
Oct 17, 2021
1 fork
2 stars
2
Insert cell
Insert cell
html
`<svg viewBox="0 0 ${
width
} ${
height
}">
<path d="${
path
(
nz_geojson
)
}" fill="none" stroke="black"></path>
</svg>`
Insert cell
projection
=
d3
.
geoIdentity
(
)
.
reflectY
(
true
)
.
fitWidth
(
width
,
nz_geojson
)
Insert cell
path
=
d3
.
geoPath
(
projection
)
Insert cell
width
=
954
Insert cell
height
=
Math
.
ceil
(
path
.
bounds
(
nz_geojson
)
[
1
]
[
1
]
)
Insert cell
zip
=
require
(
await
FileAttachment
(
"node-zip-1.1.1"
)
.
url
(
)
)
Insert cell
files
=
zip
(
await
FileAttachment
(
"regional-council-2020-clipped-generalised geojson trimmed.zip"
)
.
arrayBuffer
(
)
,
{
base64
:
false
,
checkCRC32
:
true
}
)
.
files
Insert cell
nz_geojson
=
JSON
.
parse
(
files
[
'regional-council-2020-clipped-generalised geojson trimmed.json'
]
.
asText
(
)
)
Insert cell
d3
=
require
(
'd3'
)
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
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
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
zip
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
files
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
nz_geojson
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML