Published
Edited
Apr 27, 2020
1 star
Insert cell
Insert cell
ukMap = map(
proj4d3(
`+proj=laea +lat_0=90 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs`
).fitExtent([[0, -5700], [width * 1, height * 0.95]], uk),
{
land: uk,
inertia: false
}
)
Insert cell
proj4 = require("proj4")
Insert cell
function proj4d3(proj4string) {
const degrees = 180 / Math.PI,
radians = 1 / degrees,
raw = proj4(proj4string),
p = function(lambda, phi) {
return raw.forward([lambda * degrees, phi * degrees]);
};
p.invert = function(x, y) {
return raw.inverse([x, y]).map(function(d) {
return d * radians;
});
};
const projection = d3.geoProjection(p).scale(1);
projection.raw = raw;
return projection;
}
Insert cell
Insert cell
uk = await FileAttachment("NUTS_Level_1_January_2018_Ultra_Generalised_Clipped_Boundaries_in_the_United_Kingdom.geojson").json()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
graticule = d3.geoGraticule()()
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