Reference · Framing, geometry and quiz tools
ChizuRegiontype
One place on a map: a country on the world, a province or state on a country.
Import it
import type { ChizuRegion } from "@johnmorrisdotca/chizu";
Definition
interface ChizuRegion {
code: string;
iso?: string;
name: string;
nameJa?: string;
nameShortJa?: string;
reading?: string;
group: string;
groupJa?: string;
unnamed?: boolean;
groupAliases?: string[];
type?: string;
iso3?: string;
path: string;
bbox: [
number,
number,
number,
number
];
centroid: [
number,
number
];
neighbors: string[];
}
Members
| Name | Type | Description |
|---|---|---|
code | string | Its code within its map: an ISO 3166-1 alpha-2 code on the world ( |
iso (optional) | string | undefined | Its ISO 3166-2 code, the full form ( |
name | string | Its English name. |
nameJa (optional) | string | undefined | Its name in Japanese, where there is one. |
nameShortJa (optional) | string | undefined | The everyday short name where it is not |
reading (optional) | string | undefined | How |
group | string | What kind of region it sits among, for choosing look-alikes: a continent on the world, a larger part of the country on a country's map. |
groupJa (optional) | string | undefined |
|
unnamed (optional) | boolean | undefined | True for a piece of land the map draws but does not name: the one is a 38 km² piece of the Yamal coast Natural
Earth gives no name or code. It is drawn, so the coast has no hole, but |
groupAliases (optional) | string[] | undefined | Other names |
type (optional) | string | undefined | What kind of division it is, as Natural Earth names it, lower case: |
iso3 (optional) | string | undefined | The three-letter code, on the world and on a country's own map. |
path | string | Its outline, |
bbox | [number, number, number, number] | The box round all of it. |
centroid | [number, number] | The middle of it, which falls in the sea when the place is a chain or a crescent: |
neighbors | string[] | The codes of the regions that share a border point with it, in order. |
Examples
import { loadDivisions } from "@johnmorrisdotca/chizu/load";
import type { ChizuRegion } from "@johnmorrisdotca/chizu";
const canada = (await loadDivisions("ca"))!;
const ontario: ChizuRegion = canada.regions.find((region) => region.code === "ON")!;
console.log(ontario.iso, ontario.name, ontario.nameJa, ontario.group, ontario.neighbors.join(" "));
// CA-ON Ontario オンタリオ州 Central MB QCCA-ON Ontario オンタリオ州 Central MB QCWhat it prints (run when this page was built)