Reference · Cities: lookups and loading (the tiers load on demand; the size counts every tier)
Citytype
One city, as every tier hands it out (frozen): plain numbers and codes, null where no source has the fact.
Import it
import type { City } from "@johnmorrisdotca/kuni/cities";
Also exported from: @johnmorrisdotca/kuni/cities/capitals, @johnmorrisdotca/kuni/cities/1m, @johnmorrisdotca/kuni/cities/100k
Definition
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;
}
Members
| Name | Type | Description |
|---|---|---|
id | string | 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 |
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: |
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". |
country | string | The ISO 3166-1 alpha-2 code of its country, two capital letters: "FR". |
lat | number | Its latitude in degrees, north positive. |
lon | number | Its longitude in degrees, east positive. |
nativeLanguage (optional) | string | undefined | The language code of |
population | number | null | The people living there, as the source gives it; |
populationDate | string | null | The day the population is for: a year ("2020", for 1 January of it) or a day ("2020-10-01"); |
subdivision | string | null | The ISO 3166-2 code of its first-level subdivision, "FR-IDF"; |
timeZone (optional) | string | undefined | The IANA time zone it keeps, "Asia/Tokyo", so that a page can show the time there (give it as the |
timeZoneEstimated (optional) | boolean | undefined | Present with |
elevation (optional) | 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; |
capitalOf | readonly 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 |
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 |
inMetroOf | string | 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. |
urbanAreaUnknown | boolean | 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. |
rankEstimated | boolean | True where the figure every list ranks the city by is an estimate: Wikidata's metropolitan area ( |
Examples
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
nationalWhat it prints (run when this page was built)