Reference · Load maps and features
loadCountryfunction
One country alone, drawn from Natural Earth's 1:50m countries (the small ones from 1:10m); null for a code with no map.
Import it
import { loadCountry } from "@johnmorrisdotca/chizu/load";
Definition
function loadCountry(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 country map, or null when no built-in map exists for its code.
Examples
import { loadCountry } from "@johnmorrisdotca/chizu/load";
const japan = (await loadCountry("jp"))!;
console.log(japan.id, japan.kind, japan.regions.length, await loadCountry("xx"));
// country-jp country 1 nullcountry-jp country 1 nullWhat it prints (run when this page was built)