utm_id.Rd
The utm_id
function will identify the UTM grid codes
that touches and those in the vicinity (queen or rook) of roi.
utm_id(grid = utm10, roi = roi, buf = NULL, contiguity = "queen")
grid | character indicating the UTM grid. Ensure you provide an 'UTM' column as grid code. |
---|---|
roi | an spatial object sf, st, spatialpolygonsdataframe identifying the roi.' It can be of any valid vector type (point, line, polygon or collection). |
buf | numeric indication whether the roi should be buffered to a given distance (meter). Default is NULL |
contiguity | character identifying the contiguity search method "queen" or "rook". |
A vector with UTM codes for study site (ae) and contiguous grids.
Make sure you have a topologically valid vector. Using external files (like a shapefile) will require the .prj otherwise identify it with the corresponding numeric epsg code. Currently only rook and queen implemented (not bishop)
Paulo E. Cardoso
if (FALSE) { require(tabulEIA) require(sf) require(tidyverse) # get UTM codes for your roi d <- data.frame(a = 1) d$geom <- "Polygon ((-8.2522 37.8960, -8.2513 37.8960, -8.2513 37.8951, -8.2522 37.8951, -8.2522 37.8960))" ae <- sf::st_as_sf(d, wkt = "geom") ae <- sf::st_set_crs(ae, 4326) utm_all <- utm_id(grid = utm10k, roi = ae, buf = NULL, contiguity = "queen") utm_ae <- utm_all$ae utm_ae utm_contig <- utm_all$contig utm_contig }