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
| Name | Type | Description |
|---|---|---|
map | Pick<ChizuMap, "projection"> | The map the runways go on. |
ports | readonly ChizuPort[] | The airports to draw the runways of (a harbour is passed over). |
runways | Readonly<Record<string, readonly ChizuRunway[]>> | The runways, by airport id. |
box | MapBox | The window. |
offsets | readonly number[] | The copies of the canvas across a wrapping map ( |
options | ChizuPortOptions | The tier ( |
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"'));
// truetrueWhat it prints (run when this page was built)