Public
Edited
Jul 9, 2021
2 stars
Insert cell
Insert cell
Insert cell
map()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
comuni_data = comuni.features.map(d => d.properties)
Insert cell
Insert cell
Insert cell
md`descrizione dati (sorgenti e contenuto)`
Insert cell
md`### Mapshaper`
Insert cell
md`Import shp dbf and prj into https://mapshaper.org/ .
Open console. If you want, you can remove attribute fields to save about 1MB. Make sure to keep the fields that identify the subdivision:
\`\`\`
filter-fields fields='COD_RIP,COD_REG,COD_PROV,PRO_COM,COMUNE,COMUNE_A'
\`\`\`

Simplify. Try 38.8% and repair all line intersections.

Export as topojson.`
Insert cell
Insert cell
italyz = FileAttachment("comuni.topo.json").json()
Insert cell
italy = FileAttachment("comuni.topo.json").json()
Insert cell
comuni = topojson.feature(italy, italy.objects.comuni)
Insert cell
Insert cell
projection = d3.geoAzimuthalEqualArea() // Lambert equal-area
.rotate([-9, -53]) // centered in Germany (FIXME?)
.fitExtent([[0, 0], [w, h]], comuni)
Insert cell
path = d3.geoPath().projection(projection)
Insert cell
Insert cell
d3 = require("d3@5")
Insert cell
topojson = require("topojson-client@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.
Learn more