Reference · Load maps and features
loadDivisionsfunction
The regions of one country, from Natural Earth's 1:10m states and provinces; null for a country that has none.
Import it
import { loadDivisions } from "@johnmorrisdotca/chizu/load";
Definition
function loadDivisions(code: string): Promise<ChizuMap | null>
Parameters
| Name | Type | Description |
|---|---|---|
code | string | The native region or country code; null clears a region selection where accepted. |
Returns
Promise<ChizuMap | null>
The requested subdivision map, or null when no built-in subdivision map exists for its code.
Examples
import { loadDivisions } from "@johnmorrisdotca/chizu/load";
const japan = (await loadDivisions("jp"))!;
const tokyo = japan.regions.find((region) => region.iso === "JP-13")!;
console.log(japan.regions.length, tokyo.code, tokyo.nameJa, tokyo.reading, tokyo.group);
// 47 13 東京都 とうきょうと Kanto47 13 東京都 とうきょうと KantoWhat it prints (run when this page was built)