a5_cell_to_boundary: Get cell boundary polygons

View source: R/boundary.R

a5_cell_to_boundaryR Documentation

Get cell boundary polygons

Description

Returns the boundary of each cell as a wk::wkt() or wk::wkb() polygon geometry. Boundaries are pentagonal polygons on the WGS 84 ellipsoid.

Usage

a5_cell_to_boundary(
  cell,
  format = c("wkb", "wkt"),
  closed_ring = TRUE,
  segments = NULL,
  closed
)

Arguments

cell

An a5_cell vector.

format

Character scalar, either "wkb" (default) or "wkt".

closed_ring

Logical scalar; if TRUE (default) the ring is closed (first vertex repeated at end).

segments

Integer scalar or NULL. Number of segments per cell edge. A5 cell edges are slightly curved on the sphere: a single segment between two vertices strays from the true edge by up to about 450 m at resolution 6, 25 m at resolution 8 and 1.5 m at resolution 10. The error falls with the square of the number of segments. NULL uses the A5 default of max(1, 2^(6 - resolution)), so at resolution 6 and finer each edge is a single segment. Pass a larger value when the polygons are used for spatial tests rather than display.

closed

Deprecated: renamed closed_ring, as in the other A5 libraries.

Value

A wk_wkt or wk_wkb vector of polygon geometries with wk::wk_crs_longlat() CRS.

See Also

a5_cell_to_boundary_xy() for the same vertices as flat coordinate vectors; a5_cell_to_lonlat() for cell centroids.

Examples

cell <- a5_lonlat_to_cell(-3.19, 55.95, resolution = 5)
a5_cell_to_boundary(cell)
a5_cell_to_boundary(cell, format = "wkt")

a5R documentation built on Oct. 19, 2026, 5:08 p.m.