as_csquares {csquares} | R Documentation |
Convert lon-lat coordinates into c-square codes
Description
Takes WGS84 longitude and latitude coordinates and finds the closest matching c-squares for a given resolution.
Usage
as_csquares(x, resolution, csquares, ...)
## Default S3 method:
as_csquares(x, resolution, csquares, ...)
## S3 method for class 'character'
as_csquares(x, resolution, csquares, validate = TRUE, ...)
## S3 method for class 'numeric'
as_csquares(x, resolution = 1, csquares, ...)
## S3 method for class 'data.frame'
as_csquares(x, resolution = 1, csquares, ...)
## S3 method for class 'sf'
as_csquares(x, resolution = 1, csquares, ..., use_centroids = TRUE)
## S3 method for class 'sfc'
as_csquares(x, resolution = 1, csquares, ..., use_centroids = TRUE)
## S3 method for class 'stars'
as_csquares(x, resolution = 1, csquares, ...)
Arguments
x |
An object to be coerced to a |
resolution |
Resolution (in WGS84 degrees) to be used for creating c-squares codes. As per c-square specifications, the resolution should be 10 or less, yet greater than 0. It should be a tenfold of 1 or 5. Valid resolutions are therefore: 10, 5, 1, 0.5, 0.1, etc. |
csquares |
If |
... |
Currently ignored |
validate |
A |
use_centroids |
In case |
Value
Returns a csquares
object that contains c-squares codes.
Author(s)
Pepijn de Vries
Examples
as_csquares(cbind(x = 5.2399066, y = 52.7155812), resolution = 1)
orca_csq <- as_csquares(orca, csquares = "csquares")