Reference · The realistic Earth's pure parts
codesNearfunction
The codes whose boxes come within angle degrees of a place: the countries whose regions a view may show.
Import it
import { codesNear } from "@johnmorrisdotca/chikyu-earth/realistic";
Definition
function codesNear(boxes: ReadonlyMap<string, readonly [number, number, number, number]>, lon: number, lat: number, angle: number): string[]
Parameters
| Name | Type | Description |
|---|---|---|
boxes | ReadonlyMap<string, readonly [number, number, number, number]> | The boxes from |
lon | number | The place's longitude, degrees. |
lat | number | The place's latitude, degrees. |
angle | number | How far round the sphere the view reaches from the place, degrees (90 for the whole near side). |
Returns
string[]
The codes, in the boxes' order.
Examples
import { codesNear } from "@johnmorrisdotca/chikyu-earth/realistic";
const boxes = new Map<string, [number, number, number, number]>([["JP", [122, 24, 154, 46]], ["BR", [-74, -34, -34, 5]]]);
console.log(codesNear(boxes, 139.7, 35.7, 10));[ 'JP' ]What it prints (run when this page was built)