Skip to the content

Chizu地図

Draw SVG maps of the world, its 253 countries and the regions of 33 of them, frame them, place numbered callouts and build geography quizzes, with names in English and Japanese today (Spanish, German and Chinese are planned).

Chizu is the Japanese word 地図 for map. About the name

Contents

Reference · Framing, geometry and quiz tools

runwaysSvgfunction

The runways a window shows as SVG, for drawChizu: a <g class="cz-runways"> holding a <line class="cz-runway" data-airport="…"> for each runway of each airport in ports that the window's tier shows, the line between its two ends with the stroke as wide as the runway is on the ground (no thinner than a hairline). A runway shorter than 1.2% of the window's width is left out, so none is drawn until the window shows a few hundred kilometres. Empty when none is.

Import it

import { runwaysSvg } from "@johnmorrisdotca/chizu";

Definition

function runwaysSvg(map: Pick<ChizuMap, "projection">, ports: readonly ChizuPort[], runways: ChizuRunways, box: MapBox, offsets: readonly number[], options: ChizuPortOptions): string

Parameters

NameTypeDescription
mapPick<ChizuMap, "projection">

The map the runways go on.

portsreadonly ChizuPort[]

The airports to draw the runways of (a harbour is passed over).

runwaysReadonly<Record<string, readonly ChizuRunway[]>>

The runways, by airport id.

boxMapBox

The window.

offsetsreadonly number[]

The copies of the canvas across a wrapping map ([0] for one).

optionsChizuPortOptions

The tier (portOptions's).

Returns

string

The SVG text, or "".

Examples

import { localMap, runwaysSvg, wholeMapBox, type ChizuPort } from "@johnmorrisdotca/chizu";

const map = localMap({ centre: [139.78, 35.55], widthMetres: 6000 });
const haneda: ChizuPort = { id: "hnd", kind: "airport", name: { en: "Haneda" }, country: "JP", lat: 35.55, lon: 139.78, tier: 1 };
const svg = runwaysSvg(map, [haneda], { hnd: [[139.77, 35.54, 139.79, 35.56, 60]] }, wholeMapBox(map), [0], {});
console.log(svg.includes('data-airport="hnd"'));
// true
true

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chizu 1.17.0.