Skip to the content

Chikyu Earth地球

A line-drawn globe of the world's countries that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place.

Chikyu is the Japanese word 地球 for the Earth. About the name

Contents

Reference · The place under a point: country, sea, continent and the nearest city

placeOffunction

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 it

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

Definition

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

Parameters

NameTypeDescription
lonnumber

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

latnumber

Degrees north, -90 to 90.

options (optional)PlaceOptions | undefined

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

Returns

PlaceOf

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

Examples

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

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chikyu-earth 0.51.1.