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

ChizuMaptype

A map: a canvas and its regions. What every file of data holds, and what every function of the engine takes.

Import it

import type { ChizuMap } from "@johnmorrisdotca/chizu";

Definition

interface ChizuMap {
    id: string;
    kind: "world" | "country" | "divisions" | "local";
    name: string;
    nameJa?: string;
    regionName: string;
    regionNamePlural: string;
    viewBox: string;
    width: number;
    height: number;
    wraps: boolean;
    projection: ChizuProjection;
    insets: ChizuInset[];
    source: string;
    regions: ChizuRegion[];
}

Members

NameTypeDescription
idstring

world, country-fr (France alone, from Natural Earth's countries) or divisions-fr (its départements).

kind"world" | "country" | "divisions" | "local"

What its regions are: the whole world, a single country, the divisions of one, or the shapes of a local map of a city or a venue.

namestring

The map's name in English and Japanese.

nameJa (optional)string | undefined
regionNamestring

What a region is called here, singular and plural, in English: Country, Province.

regionNamePluralstring
viewBoxstring

The canvas: 0 0 width height.

widthnumber
heightnumber
wrapsboolean

Whether its east edge is its west edge: a map of the earth is a cylinder cut open, and pans round without stopping.

projectionChizuProjection
insetsChizuInset[]

The regions drawn in boxes of their own.

sourcestring

Where the outlines come from, in a line.

regionsChizuRegion[]

Examples

import WORLD from "@johnmorrisdotca/chizu/world";
import type { ChizuMap } from "@johnmorrisdotca/chizu";

const map: ChizuMap = WORLD;
console.log(map.id, map.kind, map.viewBox, map.regions.length, map.wraps);
// world world 0 0 1000 489 173 true
world world 0 0 1000 489 173 true

What it prints (run when this page was built)

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