| a5_cell_to_boundary_xy | R Documentation |
Returns the boundary vertices of every cell in one pair of coordinate
vectors, with a vector of per-cell vertex counts. This skips building a
geometry for each cell, so it suits drawing many cells at once, for
example as a single grid::polygonGrob() with id.lengths = lengths.
a5_cell_to_boundary_xy(cell, closed_ring = FALSE, segments = NULL, closed)
cell |
An a5_cell vector. |
closed_ring |
Logical scalar; if |
segments |
Integer scalar or |
closed |
Deprecated: renamed |
The vertices and their order are those of a5_cell_to_boundary().
Longitudes within a ring are continuous, as in the other A5 libraries: a
ring that crosses the antimeridian continues past 180 or -180 instead of
jumping, so x can fall outside [-180, 180]. Shift or split such rings
before drawing them on a map that wraps at the antimeridian. A ring around
a pole cannot be drawn as a simple polygon in longitude and latitude.
A list with three elements:
x: double vector of longitudes, every cell's vertices in turn.
y: double vector of latitudes, aligned with x.
lengths: integer vector with the number of vertices of each cell,
the same length as cell. An NA cell has length 0.
a5_cell_to_boundary() for polygon geometries.
cells <- a5_lonlat_to_cell(c(-3.19, -3.10), c(55.95, 55.90), resolution = 9)
xy <- a5_cell_to_boundary_xy(cells)
xy$lengths
# one grob for all cells
grob <- grid::polygonGrob(
xy$x, xy$y,
id.lengths = xy$lengths,
default.units = "native"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.