Reference · Framing, geometry and quiz tools
ChizuLocalCanvastype
What a local map is made of: where, how big in metres, and how many metres a unit of its canvas is.
Import it
import type { ChizuLocalCanvas } from "@johnmorrisdotca/chizu";
Definition
type ChizuLocalCanvas = {
centre: readonly [
number,
number
];
widthMetres: number;
heightMetres?: number;
metresPerUnit?: number;
};
Members
| Name | Type | Description |
|---|---|---|
centre | readonly [number, number] | The middle of the canvas: longitude and latitude, in degrees. |
widthMetres | number | How wide the canvas is on the ground, in metres. |
heightMetres (optional) | number | undefined | How tall it is on the ground, in metres. Default: as wide. |
metresPerUnit (optional) | number | undefined | How many metres a unit of the canvas is, stated in the map's |
Examples
import { localMap, type ChizuLocalOptions } from "@johnmorrisdotca/chizu";
// A canvas 600 m across and 400 m tall, round Tokyo Station, one unit to the metre.
const options: ChizuLocalOptions = { centre: [139.7671, 35.6812], widthMetres: 600, heightMetres: 400, metresPerUnit: 1 };
console.log(localMap(options).viewBox);
// 0 0 600 4000 0 600 400What it prints (run when this page was built)