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 = TRUE,
segments = NULL
)Arguments
- cell
An a5_cell vector.
- format
Character scalar, either
"wkb"(default) or"wkt".- closed
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.NULLuses the A5 default ofmax(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.
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)
#> <wk_wkb[1] with CRS=OGC:CRS84>
#> [1] <POLYGON ((-4.490769 56.63193, -4.575103 55.93184, -4.654266 55.23196, -3.592316 55.41531, -2.521971 55.5901, -2.031558 56.23106...>
a5_cell_to_boundary(cell, format = "wkt")
#> <wk_wkt[1] with CRS=OGC:CRS84>
#> [1] POLYGON ((-4.490769 56.63193, -4.575103 55.93184, -4.654266 55.23196, -3.592316 55.41531, -2.521971 55.5901, -2.031558 56.23106...
