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
引数
| 名前 | 型 | 説明 |
|---|---|---|
lon | number | Degrees east. A value outside -180 to 180 is wrapped. |
lat | number | 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出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。