Skip to the content

Chizu地図

Draw SVG maps, frame regions, place numbered callouts and build geography quizzes with English and Japanese names.

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

Contents

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

NameTypeDescription
centrereadonly [number, number]

The middle of the canvas: longitude and latitude, in degrees.

widthMetresnumber

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 projection. Default: the longer side over 1,000, so a local canvas is 1,000 across like every other 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 400
0 0 600 400

What it prints (run when this page was built)

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