本文へ移動

Chizu地図

世界、253の国、33か国の州や県などの地域を、SVGの地図に描けます。表示する範囲を決めたり、番号付きの注記をつけたり、地理クイズを作ったりもできます。名前は今のところ英語と日本語で、スペイン語、ドイツ語、中国語にも対応する予定です。

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

目次

リファレンス · /cities

ChizuCity型

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

One city as the layer reads it: the fields of kuni's City that a map needs, so a kuni city is one as it is.

インポート

import type { ChizuCity } from "@johnmorrisdotca/chizu/cities";

ほかのエクスポート元: @johnmorrisdotca/chizu

定義

type ChizuCity = {
    id: string;
    name: {
        en: string;
        ja?: string;
        jaShort?: string;
    };
    lat: number;
    lon: number;
    population?: number | null;
    capital?: string | null;
    country?: string;
};

メンバー

名前型説明
idstring

Stable and unique in the list: the drawing's data-city.

name{ en: string; ja?: string; jaShort?: string; }

Its name in English, and in Japanese where it is known; a Japanese page prints the English name where there is none. jaShort is the Japanese name a map labels it by (東京 for 東京都, 大阪 for 大阪市: kuni 1.6.3 gives it); where it is given, the label is it and the full name is the dot's title.

latnumber

Latitude in degrees, north positive.

lonnumber

Longitude in degrees, east positive.

population (省略可)number | null | undefined

The people living there; null or absent where it is not known, which puts the city last.

capital (省略可)string | null | undefined

national for a country's capital, drawn with a ring; any other value, or none, is a plain dot.

country (省略可)string | undefined

Its country's ISO 3166-1 alpha-2 code, JP: a map of one country alone names only that country's cities.

例

import type { ChizuCity } from "@johnmorrisdotca/chizu";

const paris: ChizuCity = { id: "Q90", name: { en: "Paris", ja: "パリ" }, lat: 48.857, lon: 2.352, population: 2_145_906, capital: "national" };
console.log(paris.name.en);
// Paris
Paris

出力(このページを作ったときに実行した結果)

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

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