gridTileAtfunction
The column and row of the tile that holds a point, or undefined when the point is off the Earth or the tile that would hold it misses the Earth.
A longitude of 180 is the same meridian as -180, and both fall in column 0. A latitude of -90 falls in the last row that still meets the Earth.
Import it
import { gridTileAt } from "@johnmorrisdotca/chikyu-earth/door";
Definition
function gridTileAt(level: MapGridLevel, lon: number, lat: number, extent: MapGrid["extent"]): { col: number; row: number; } | undefined
Parameters
| Name | Type | Description |
|---|---|---|
level | MapGridLevel | The level. |
lon | number | The longitude in degrees. |
lat | number | The latitude in degrees. |
extent | { west: number; south: number; east: number; north: number; } | The Earth's extent. |
Returns
{ col: number; row: number; } | undefined
The tile, or undefined.
Examples
import { gibsGrid, gridTileAt } from "@johnmorrisdotca/chikyu-earth/door";
const level = gibsGrid("250m").levels[3]!;
console.log(gridTileAt(level, 180, 0, gibsGrid("250m").extent));{ col: 0, row: 2 }What it prints (run when this page was built)