Reference · Framing, geometry and quiz tools
ChizuOverlaytype
One overlay. A line runs through its points in order, unbroken across the date line: each step is taken the short
way round (170 to -170 is 20 degrees east, and 350 to 10 is 20 degrees too), so a track that goes round the world is
one line; give each part of a track its own line for a style of its own. A mark is a dot at a point, with an optional
label; its longitude may be any number of turns round. An area is a ring of points filled (the night side), drawn
as given: its longitudes must run on without a jump (170 to 190, not 170 to -170, which fills a band round the
whole map), and a ring round a pole runs along its edge from -180 to 180 and back along the pole. Latitudes past a
pole are held to it. Colours are CSS colours or var(--name); widths and sizes are in CSS pixels, so a small map reads
as well as a large one; opacity is the area's fill opacity, 0 to 1.
Import it
import type { ChizuOverlay } from "@johnmorrisdotca/chizu";
Definition
type ChizuOverlay = {
kind: "line";
points: readonly ChizuLatLon[];
color?: string;
width?: number;
dash?: readonly number[];
id?: string;
} | {
kind: "mark";
at: ChizuLatLon;
label?: string;
color?: string;
size?: number;
id?: string;
} | {
kind: "area";
ring: readonly ChizuLatLon[];
color?: string;
opacity?: number;
id?: string;
};
Examples
import type { ChizuOverlay } from "@johnmorrisdotca/chizu";
const overlays: ChizuOverlay[] = [
{ kind: "line", points: [[0, 170], [10, -170]], color: "#c33", width: 2 },
{ kind: "mark", at: [35.68, 139.69], label: "Tokyo" },
];
console.log(overlays.length);
// 22What it prints (run when this page was built)