a5_cell_to_lonlat: Convert A5 cell indices to coordinates

View source: R/indexing.R

a5_cell_to_lonlatR Documentation

Convert A5 cell indices to coordinates

Description

Returns the centre-point longitude and latitude of each cell.

Usage

a5_cell_to_lonlat(cell, normalise = TRUE)

Arguments

cell

An a5_cell vector (or character coercible to one).

normalise

Logical scalar. If TRUE (default), longitudes are wrapped to [-180, 180] and returned as a wk::xy() vector. If FALSE, raw unwrapped coordinates are returned as a data frame (lon, lat) — useful for calculations spanning the antimeridian.

Value

A wk::xy() vector (if normalise = TRUE) or a data frame with columns lon and lat.

See Also

a5_lonlat_to_cell() for the inverse operation, a5_cell_to_boundary() for full cell polygons.

Examples

cell <- a5_lonlat_to_cell(-3.19, 55.95, resolution = 5)
a5_cell_to_lonlat(cell)

# Raw unwrapped coordinates
cell2 <- a5_lonlat_to_cell(114.8, 4.1, resolution = 5)
a5_cell_to_lonlat(cell2, normalise = FALSE)

a5R documentation built on March 26, 2026, 5:10 p.m.