本文へ移動

Chizu地図

SVGの地図を描き、地域を表示範囲に収め、番号付きの注記や地理クイズを英語と日本語の名前で作れます。

「地図」は、土地や場所を図で表したものです。 名前について(英語)

目次

リファレンス

地図と地物を読み込む

import { … } from "@johnmorrisdotca/chizu/load";

最小化と gzip 圧縮をしたサイズは 6614.0 kB(読み込むものをすべて含み、esbuild で計測)

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Loading a map by name, one country at a time: loadCountry("fr") is France alone, loadDivisions("fr") its départements. Each is a dynamic import of a file of its own, so a bundler makes a chunk for each and a page fetches only the ones it draws.

エクスポート

名前種類概要
COUNTRY_CODES定数Every country that has a map of its own, by code, upper or lower case.
DIVISIONS_CODES定数Every country that has a map of its own regions (provinces, states, départements), by code.
FEATURE_MAPS定数The ids of every map that has named features of its own: the world, and each country alone or by its regions whose canvas holds a sea, a lake, a river, a landform or a peak big enough to see.
loadCountry関数One country alone, drawn from Natural Earth's 1:50m countries (the small ones from 1:10m); null for a code with no map.
loadDivisions関数The regions of one country, from Natural Earth's 1:10m states and provinces; null for a country that has none.
loadFeatures関数The named features of a map (its seas, lakes, rivers, landforms and peaks), drawn on its own canvas, by the map or its id: a file of its own, fetched only when asked for.
loadWorldDetail関数The world drawn finer: the same 173 countries on the same canvas, in the same projection, from Natural Earth's 1:50m outlines rather than its 1:110m ones, about 1.3 MB.

ソースを見るGitHub で編集@johnmorrisdotca/chizu 1.5.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。