Published
Edited
Nov 14, 2021
Importers
17 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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more