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

groupMapfunction

The map cut down to a group: the same canvas, only the regions whose codes are given (in the map's order), only their boxes, and neighbours only among themselves. What a quiz or a callout sheet within the group is given, so that "which country of Africa is this?" offers African look-alikes and numbers African countries only. Codes the map does not have are passed over.

Import it

import { groupMap } from "@johnmorrisdotca/chizu";

Definition

function groupMap(map: ChizuMap, codes: ReadonlyArray<string | number>, names?: { id?: string; name?: string; nameJa?: string; }): ChizuMap

Parameters

NameTypeDescription
mapChizuMap

The native map or map fields required by this signature; coordinates and region codes belong to its canvas.

codesreadonly (string | number)[]

Native region codes from this map, in the requested order.

names (optional){ id?: string; name?: string; nameJa?: string; }

Optional names for the resulting group map.

Returns

ChizuMap

The map cut down to a group: the same canvas, only the regions whose codes are given (in the map's order), only their boxes, and neighbours only among themselves. What a quiz or a callout sheet within the group is given, so that "which country of Africa is this?" offers African look-alikes and numbers African countries only. Codes the map does not have are passed over.

Examples

import WORLD from "@johnmorrisdotca/chizu/world";
import { CHIZU_CONTINENTS } from "@johnmorrisdotca/chizu/names";
import { findQuestion, groupMap, seededRandom } from "@johnmorrisdotca/chizu";

const africa = CHIZU_CONTINENTS.find((continent) => continent.code === "AF")!;
const map = groupMap(WORLD, africa.codes, { name: africa.name, nameJa: africa.nameJa });
console.log(map.regions.length, findQuestion(map, "KE", seededRandom(1))?.choices.length);
// 50 4
50 4

What it prints (run when this page was built)

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