| a5_covering_predicates | R Documentation |
a5_contains() tests whether each cell is in a covering, and
a5_overlaps() whether two coverings share any cell. Both work on the
compacted cells, without expanding them, and element by element,
recycling a length-one argument.
a5_contains(x, cell)
a5_overlaps(x, y)
x |
An a5_covering vector, or an object |
cell |
An a5_cell vector, each at the resolution of its covering. |
y |
An a5_covering vector, at the same resolution as |
a5_contains() is a point-in-polygon test once the point is indexed at
the covering's resolution:
a5_contains(covering, a5_lonlat_to_cell(lon, lat, a5_covering_resolution(covering))).
The cell must be at the covering's resolution, or it is an error: A5 cells
do not nest geometrically, so a finer cell is not guaranteed to lie inside
the coarser cell that holds it in the index. An empty covering contains no
cell.
A logical vector of the common size of the inputs. NA where
either input is NA.
a5_set_operations.
poly <- wk::wkt("POLYGON ((-3.4 55.85, -3 55.85, -3 56.05, -3.4 56.05, -3.4 55.85))")
edinburgh <- a5_polygon_to_cells(poly, resolution = 12)
# point in polygon, at the covering's resolution
points <- a5_lonlat_to_cell(c(-3.19, -4.25), c(55.95, 55.86), resolution = 12)
a5_contains(edinburgh, points)
cap <- a5_spherical_cap(points, radius = 5000)
a5_overlaps(edinburgh, cap)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.