本文へ移動

Chikyu Earth地球

世界の国の輪郭を線で描いた地球儀です。地球と同じ速さで回ります。宇宙から見たような地球と、好きな場所の目印も使えます。

「地球」(ちきゅう) は、私たちが住む星の名前です。 名前について(英語)

目次

リファレンス · SVG文字列としての地球儀

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.

featuresFeature<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

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/chikyu-earth 0.11.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。