loadDivisionsGeofunction
One country's regions as longitude and latitude, loaded on demand (the file for that country only); null for a
code with no regions. ./divisions-geo/<code> is the same file as a static import.
Import it
import { loadDivisionsGeo } from "@johnmorrisdotca/chizu/divisions-geo";
Definition
function loadDivisionsGeo(code: string): Promise<ChizuGeoCollection | null>
Parameters
| Name | Type | Description |
|---|---|---|
code | string | The country's code, in either case. |
Returns
Promise<ChizuGeoCollection | null>
The country's regions, or null when it has none.
Examples
import { loadDivisionsGeo } from "@johnmorrisdotca/chizu/divisions-geo";
const japan = (await loadDivisionsGeo("jp"))!;
const tokyo = japan.features.find((feature) => feature.properties.iso === "JP-13")!;
console.log(japan.features.length, tokyo.properties.code, tokyo.properties.nameJa, await loadDivisionsGeo("xx"));
// 47 13 東京都 null47 13 東京都 nullWhat it prints (run when this page was built)