Public
Edited
Nov 23, 2022
Paused
1 fork
18 stars
Insert cell
Insert cell
Insert cell
Insert cell
function angular(k, a) {
let angle = 0;

if (k < 2) k = 2;

// Cape of Good Hope
angle -= bump(a + 0.81) * Math.min(3, k - 2) ** 0.6 * 0.38;

// Cape Horn
angle -= bump(a + 2.42) * Math.min(3, k - 2) ** 0.8 * 0.2;

function bump(x) {
return x * Math.exp(-36 * tan(x / 4) ** 2);
}

// NZ
angle -= bump(a - 1.5) * Math.min(3, k - 2) * 0.6;

// repulsion between NZ and AUS
angle += bump(a - 1.4) * Math.min(3, k - 2) * 0.6;

// Australia
angle -= bump(a - 0.7) * Math.min(3, k - 2) * 0.3;
angle -= bump(a - 0.8) * Math.min(3, k - 2) * 0.2;

return angle;
}
Insert cell
// https://github.com/d3/d3-geo/blob/main/src/projection/azimuthal.js#L3
function azimuthalRaw(scale) {
return function (x, y) {
var cx = cos(x),
cy = cos(y),
k = scale(cx * cy);
if (k === Infinity) return [2, 0];

const rho = sqrt(cy * cy * sin(x) * sin(x) + sin(y) * sin(y));
let a = atan2(sin(y), cy * sin(x));

// The reference meridian was El Hierro
a += (el_hierro * Math.PI) / 180;

// The change in angle is a function of k and a…
a += angular(k, a);

return [k * rho * cos(a), k * rho * sin(a)];
};
}
Insert cell
scale = (c) => {
return 1 + ((c = acos(c)) && c / sin(c) - 1) * 1.6;
}
Insert cell
projection = d3
.geoProjection(azimuthalRaw(scale))
.clipAngle(148)
.rotate([0, -90])
.fitExtent(
[
[-270, -270],
[270, 270]
],
{
type: "Polygon",
coordinates: [
[
[0, 0],
[-120, 0],
[120, 0],
[0, 0]
]
]
}
)
Insert cell
// https://fr.wikipedia.org/wiki/El_Hierro#M%C3%A9ridien
el_hierro = 17 + 39 / 60 + 46 / 3600
Insert cell
// This is the English adaptation of the map, by Cole, circa 1840
// source: https://bplonline.contentdm.oclc.org/digital/collection/p15099coll3/id/538/
buache = FileAttachment("buache@1.jpeg").image({ width: 300 })
Insert cell
import { acos, atan2, cos, sin, sqrt, tan, tau } from "@fil/math"
Insert cell
// loading from https://github.com/Fil/visionscarto-world-atlas
land = d3.json(
"https://unpkg.com/visionscarto-world-atlas@0.0.6/world/110m_land.geojson"
)
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