Reference · The globe as an SVG string
COUNTRIESconstant
Every country the globe draws, as GeoJSON in longitude and latitude (177 features, Antarctica included), each with its English name, its Japanese name and its two-letter code.
Import it
import { COUNTRIES } from "@johnmorrisdotca/chikyu-earth";
Definition
const COUNTRIES: FeatureCollection<Geometry, CountryProps> = {
type: "FeatureCollection",
features: WORLD_GEO.features.map((feature) => ({
type: "Feature",
geometry: feature.geometry as Geometry,
properties: {
name: feature.properties.name,
ja: feature.properties.nameJa || null,
alpha2: feature.properties.code.length === 2 ? feature.properties.code : null,
},
})),
}
Members
| Name | Type | Description |
|---|---|---|
type | "FeatureCollection" | Specifies the type of GeoJSON object. |
features | Feature<Geometry, CountryProps>[] | |
bbox (optional) | BBox | undefined | Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. The value of the bbox member is an array of length 2*n where n is the number of dimensions represented in the contained geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. https://tools.ietf.org/html/rfc7946#section-5 |
Examples
import { COUNTRIES } from "@johnmorrisdotca/chikyu-earth";
const japan = COUNTRIES.features.find((feature) => feature.properties.alpha2 === "JP");
console.log(japan?.properties.name, japan?.properties.ja, COUNTRIES.features.length);Japan 日本 177What it prints (run when this page was built)