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 · Framing, geometry and quiz tools

windowKilometresfunction

How many kilometres of ground the window shows from side to side, at its middle; null for a map whose canvas cannot be read back to longitude and latitude (a country's regions).

Import it

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

Definition

function windowKilometres(map: Pick<ChizuMap, "projection">, box: MapBox): number | null

Parameters

NameTypeDescription
mapPick<ChizuMap, "projection">

The map whose canvas the window is on.

boxMapBox

The window.

Returns

number | null

Kilometres across, or null.

Examples

import WORLD from "@johnmorrisdotca/chizu/world";
import { windowKilometres, wholeMapBox } from "@johnmorrisdotca/chizu";

console.log(Math.round(windowKilometres(WORLD, wholeMapBox(WORLD))! / 1000) > 30);
// true
true

What it prints (run when this page was built)

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