Published
Edited
Jul 15, 2020
1 fork
1 star
Insert cell
Insert cell
function toblerMercatorRaw(lambda, phi) {
const cosPhi = Math.cos(phi);
return [
lambda * cosPhi * cosPhi,
Math.max(-5, Math.min(+5, Math.log(Math.tan((Math.PI / 2 + phi) / 2))))
];
}
Insert cell
projection = d3.geoProjection(toblerMercatorRaw)
.scale((width - 3) / (2 * Math.PI))
.translate([width / 2, height / 2])
.precision(0.2)
Insert cell
map
Insert cell
height = Math.max(640, width)
Insert cell
import {d3, map} with {height, projection} from "@d3/world-map"
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