utm_id: Identify the UTM grid squares touching and around a region of...

View source: R/utmID.R

utm_idR Documentation

Identify the UTM grid squares touching and around a region of interest (roi).

Description

The utm_id function will identify the UTM grid codes that touches and those in the vicinity (queen or rook) of roi.

Usage

utm_id(grid = utm10, roi = roi, buf = NULL, contiguity = "queen")

Arguments

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".

Details

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)

Value

A vector with UTM codes for study site (ae) and contiguous grids.

Author(s)

Paulo E. Cardoso

Examples

## Not run: 
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

## End(Not run)

pecard/tabuleia documentation built on June 16, 2022, 3:32 a.m.