本文へ移動

Kuni国

国、コード、名前、行政区画を調べ、必要なときに国のデータを読み込み、標準の国のカードを表示できます。

「国(くに)」は、国を表す日本語です。 名前について(英語)

目次

リファレンス · 都市の検索と読み込み(段階は必要なときに読み込まれ、サイズはすべての段階を含みます)

City型

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

One city, as every tier hands it out (frozen): plain numbers and codes, null where no source has the fact.

インポート

import type { City } from "@johnmorrisdotca/kuni/cities";

ほかのエクスポート元: @johnmorrisdotca/kuni/cities/capitals, @johnmorrisdotca/kuni/cities/1m, @johnmorrisdotca/kuni/cities/100k

定義

interface City {
    id: string;
    name: {
        en: string;
        ja?: string;
        jaShort?: string;
        jaReading?: string;
        native?: string;
    };
    continent: Continent;
    country: string;
    lat: number;
    lon: number;
    nativeLanguage?: string;
    population: number | null;
    populationDate: string | null;
    subdivision: string | null;
    timeZone?: string;
    timeZoneEstimated?: boolean;
    elevation?: number;
    capital: "national" | "alternate" | "subdivision" | null;
    capitalOf: readonly string[];
    source: {
        point: CitySource;
        population: CitySource | null;
        ja: CitySource | null;
    };
    metro: {
        id: string;
        name: string;
        population: number;
        populationDate: string | null;
        estimated: boolean;
    } | null;
    inMetroOf: string | null;
    urbanAreaUnknown: boolean;
    rankEstimated: boolean;
}

メンバー

名前型説明
idstring

Stable, the same in every tier and every release: the Wikidata item, "Q90" for Paris, or "ne:<number>" for a place only Natural Earth has. An id that stops being a city's (merged, or removed) is still answered by citySet(...).byId, with the record it was merged into.

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

Its name in English, and in Japanese and in its own language where a source has them: ja and native are left out, never an English name copied in; native is also left out where it is the English name. jaShort, with ja, is the Japanese name a map labels it by: 東京 for 東京都, 大阪 for 大阪市, the same as ja where nothing is dropped. jaReading is the reading of ja in hiragana, for sorting in Japanese order (とうきょうと, にゅーよーく): ja itself where its words are kana (ゴヤ (アルゼンチン) is ごや; a last 市, 区, 郡, 県, 州 or 鎮 is read し, く, ぐん, けん, しゅう, ちん); for a name in kanji only a source's, Wikidata's reading in kana (P1814) where ja is Wikidata's label, else for a city of Japan Japan Post's reading of the municipality. Left out where none is so (a name of China written in kanji), never guessed. It keeps the long-vowel mark (にゅーよーく), so sort it with a collator for Japanese ("ja"), not by code point.

continent"AF" | "AS" | "NA" | "SA" | "AN" | "EU" | "OC"

The continent of its country, in the seven-continent model kuni's groupings use: "AF", "AN", "AS", "EU", "NA", "OC" or "SA".

countrystring

The ISO 3166-1 alpha-2 code of its country, two capital letters: "FR".

latnumber

Its latitude in degrees, north positive.

lonnumber

Its longitude in degrees, east positive.

nativeLanguage (省略可)string | undefined

The language code of name.native ("fr"); absent with it.

populationnumber | null

The people living there, as the source gives it; null where no source has a figure.

populationDatestring | null

The day the population is for: a year ("2020", for 1 January of it) or a day ("2020-10-01"); null when the source gives none.

subdivisionstring | null

The ISO 3166-2 code of its first-level subdivision, "FR-IDF"; null where Wikidata does not say or kuni lists none.

timeZone (省略可)string | undefined

The IANA time zone it keeps, "Asia/Tokyo", so that a page can show the time there (give it as the timeZone of a date formatter). From IANA's zone.tab and Wikidata's subdivision zones: a country's one zone; else the zone Wikidata names for the city's subdivision alone; else the zone of the nearest city zone.tab lists for the country (timeZoneEstimated says whether that is an estimate). Left out only for a city of a country with no zone in zone.tab. docs/cities.md counts each way.

timeZoneEstimated (省略可)boolean | undefined

Present with timeZone: true where the zone is an estimate (the nearest zone.tab city's, the city being neither at its point nor that city), false where a source names it or the city is that zone.tab city. Kuni has no boundaries, so a town near a zone's edge can be given its neighbour's: say "estimated" where it is shown.

elevation (省略可)number | undefined

Its height above sea level in whole metres (negative below it), from Wikidata (CC0); left out where Wikidata has none, or several values far apart, or one no land has or one that stands out from the cities round it (a single bad value).

capital"subdivision" | "national" | "alternate" | null

"national" for the capital of a country (one only for each country), "alternate" for another seat of a country's government (Cape Town, Kyoto), "subdivision" for the capital of a subdivision; null for none.

capitalOfreadonly string[]

The codes it is the capital of (alpha-2 for a country, ISO 3166-2 for a subdivision): never empty for a capital, always empty for a city that is not one.

source{ point: CitySource; population: CitySource | null; ja: CitySource | null; }

Where each fact came from; a fact no source gave is null.

metro{ id: string; name: string; population: number; populationDate: string | null; estimated: boolean; } | null

The urban area the city heads, by one source for each country: a Canadian city's census metropolitan area or agglomeration by Statistics Canada (the estimate of 1 July 2025, else the 2021 Census; id "statcan:<DGUID>"), a city of the United States its metropolitan or micropolitan statistical area by the Census Bureau (1 July 2024, "census:<CBSA code>"), a city of another OECD member its functional urban area by the OECD ("oecd:<code>"), and the first twenty cities of China and India the urban figure of their own census (China's urban resident population of 2020, "cn-census-2020:<area>"; India's urban agglomerations of 2011, "in-census-2011:<area>"). In a country with official areas, where a city heads none, the metropolitan area Wikidata names for it where that is bigger than the city (its item, "Q683705"; CC0), an estimate. Its id, its name as the source writes it ("Seattle-Tacoma-Bellevue, WA", "West Midlands"), people, the day the figure is for, and estimated (true for Wikidata's only). null where there is none. Every list ranks a city by this figure where there is one, even below its own population, else by its own; a tier still holds a city by its own population.

inMetroOfstring | null

The id of the city whose urban area this one lies inside, where it heads none of its own: Mississauga and Brampton are in Toronto's ("Q172"). Such a city is ranked after every city that heads an area. null for the others, and in a country whose areas are Wikidata's estimates.

urbanAreaUnknownboolean

True for a city of China or India below the twenty its census gives an urban figure for: its own figure is its whole municipality (Yantai's 7 million), so it is ranked after the twenty. False for every other city.

rankEstimatedboolean

True where the figure every list ranks the city by is an estimate: Wikidata's metropolitan area (metro.estimated), or the city's own figure in a country with no official urban areas (every country but Canada, the United States, the other members of the OECD, and China's and India's first twenty). False where it is an official urban area's.

例

import type { City } from "@johnmorrisdotca/kuni/cities";
import { capitalCities } from "@johnmorrisdotca/kuni/cities/capitals";

const paris: City = capitalCities().find((one) => one.id === "Q90")!;
console.log(paris.name.en);      // "Paris"
console.log(paris.country);      // "FR"
console.log(paris.continent);    // "EU"
console.log(paris.capital);      // "national"
Paris
FR
EU
national

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

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

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