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

regionGroupsfunction

The groups a map's regions fall in, by their group, in the order the map first names them: the continents on the world, the eight regions on Japan's prefectures, the four Census regions on the United States'.

Import it

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

Definition

function regionGroups(map: Pick<ChizuMap, "regions">): ChizuGroup[]

Parameters

NameTypeDescription
mapPick<ChizuMap, "regions">

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

Returns

ChizuGroup[]

The groups a map's regions fall in, by their group, in the order the map first names them: the continents on the world, the eight regions on Japan's prefectures, the four Census regions on the United States'.

Examples

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

const groups = regionGroups(WORLD);
console.log(groups.map((group) => `${group.name} ${group.codes.length}`).join(", "));
// Asia 46, Europe 39, Africa 50, North America 18, South America 13, Oceania 7
Asia 46, Europe 39, Africa 50, North America 18, South America 13, Oceania 7

What it prints (run when this page was built)

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