Published
Edited
Nov 14, 2021
Importers
18 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
SPL = import("https://cdn.skypack.dev/spl.js@0.1.0-beta.1?min")
Insert cell
spl = SPL.default()
Insert cell
Insert cell
db = fetch(
"https://data.london.gov.uk/download/london_boroughs/9502cdec-5df0-46e3-8aa1-2b5c5233a31f/london_boroughs.gpkg"
)
.then((response) => response.arrayBuffer())
.then((d) => spl.db(d))
Insert cell
Insert cell
boroughs = db.exec("select name, geom from london_boroughs").get.objs
Insert cell
srid = db.exec("select srid(geom) from london_boroughs").get.flat
Insert cell
Insert cell
// this projection takes "already projected" data and sends it to our image coordinates
projection = d3
.geoIdentity()
.reflectY(true)
.fitExtent(
[
[20, 20],
[width - 20, height - 20]
],
{
type: "MultiPolygon",
coordinates: boroughs.map(({ geom }) => geom.coordinates)
}
)
Insert cell
path = d3.geoPath(projection)
Insert cell
height = width * 0.75
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