COUNTRIES定数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { COUNTRIES } from "@johnmorrisdotca/chikyu-earth";
定義
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,
},
})),
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
type | "FeatureCollection" | Specifies the type of GeoJSON object. |
features | Feature<Geometry, CountryProps>[] | |
bbox (省略可) | 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 |
例
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 日本 177出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。