本文へ移動

Chikyu Earth地球

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

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

目次

リファレンス · 地点の場所: 国、海、大陸、最も近い都市

placeOf関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

The country, sea or ocean, continent and nearest city at one point. Countries are the line globe's outlines, Natural Earth at 1:110m. A point inside an outline is country. A point outside every outline and within PLACE_COAST_KM (50 km) of one is near instead: the coarse coast is not reported as a country. The sea is the nearest named sea, gulf, bay or ocean within its reach (SEA_REACH_KM); a smaller water's point is nearer, so it wins over the ocean. It is null while country is set, and null when no water is within reach. The continent is the country's group in the outlines, named as in the sea-names list. Australia the country uses that continent, not the Oceania group. A point whose continent point is at least 2,500 km nearer than its country's group (eastern Russia, French Guiana) uses the nearer one. The city lists are the caller's: without cities, nearestCity is null. Towns under 100,000 are read only when towns is passed. The outlines are indexed on a 15° grid so a call is cheap enough to make about once a second.

インポート

import { placeOf } from "@johnmorrisdotca/chikyu-earth/place";

定義

function placeOf(lon: number, lat: number, options?: PlaceOptions): PlaceOf

引数

名前型説明
lonnumber

Degrees east. A value outside -180 to 180 is wrapped.

latnumber

Degrees north, -90 to 90.

options (省略可)PlaceOptions | undefined

City lists and the kilometre limit. Omit them to skip the city.

戻り値

PlaceOf

The place. Every field is null when lat is not a latitude.

例

import { placeOf } from "@johnmorrisdotca/chikyu-earth/place";

console.log(placeOf(2.35, 48.86).country?.code);
console.log(placeOf(-150, 0).sea?.id);
console.log(placeOf(0, 90).country);
FR
pacific-ocean
null

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

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

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