Skip to the content

Chizu地図

Draw SVG maps of the world, its 253 countries and the regions of 33 of them, frame them, place numbered callouts and build geography quizzes, with names in English and Japanese today (Spanish, German and Chinese are planned).

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

Contents

Reference · The world's smallest countries as dots

withSmallStatesfunction

The world with its smallest countries put back as dots. The 1:110m world has no outline for 62 of the 238 countries (Singapore, Malta, Bahrain, most of the Caribbean and the Pacific); this adds each as a small: true region, a small round shape at the middle of its largest island or piece, with its code, names, reading, continent and the countries it touches. Every region the map already has is kept as it is and the dots come after them, so the world is drawn, framed, labelled, called out and asked in a quiz as before, with the 62 as countries like any other. Only the world (id world) and its finer drawing (world-detail) get dots: any other map, and a world cut down to a group (groupMap), come back as they are, as does a world that already has every dot. The same map is returned for the same input, and the map given is never changed.

It is its own entry, so the table costs nothing until it is used. Draw or ask with the dots by giving the functions the map it returns: drawChizu(withSmallStates(WORLD)), findQuestion(withSmallStates(WORLD), "SG", random), pickDistractors(withSmallStates(WORLD), "SG"). mountChizu (smallStates: true), <chizu-map small-states> and <chizu-quiz small-states> fetch the entry themselves, only when that is on.

Import it

import { withSmallStates } from "@johnmorrisdotca/chizu/small-states";

Definition

function withSmallStates<M extends SmallStatesMap>(map: M): M

Parameters

NameTypeDescription
mapM

The world map, or its finer drawing; any other map is returned unchanged.

Returns

M

The map with a dot added for each small country it does not draw, or map itself when there is nothing to add.

Examples

import WORLD from "@johnmorrisdotca/chizu/world";
import { withSmallStates } from "@johnmorrisdotca/chizu/small-states";

const withDots = withSmallStates(WORLD);
const singapore = withDots.regions.find((region) => region.code === "SG")!;
console.log(WORLD.regions.length, withDots.regions.length, singapore.small, singapore.nameJa);
// 173 235 true シンガポール
173 235 true シンガポール

What it prints (run when this page was built)

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