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

Scorabletype

The parts of a place this scoring reads, so a map of your own places needs no more than these.

Import it

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

Definition

type Scorable = {
    code: string | number;
    group: string;
    centroid: readonly [
        number,
        number
    ];
    neighbors: ReadonlyArray<string | number>;
};

Members

NameTypeDescription
codestring | number

A code, text or a number: a map of your own places may key them by either, and neighbours are compared as text.

groupstring
centroidreadonly [number, number]
neighborsreadonly (string | number)[]

Examples

import { distractorScore, type Scorable } from "@johnmorrisdotca/chizu";

const north: Scorable = { code: "N", group: "Island", centroid: [10, 10], neighbors: ["S"] };
const south: Scorable = { code: "S", group: "Island", centroid: [10, 60], neighbors: ["N"] };
console.log(distractorScore(north, south, 100) > 100);
// true
true

What it prints (run when this page was built)

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