epsg_for_utm: EPSG code for the UTM zone based on geographic location(s)

View source: R/crs.R

epsg_for_utmR Documentation

EPSG code for the UTM zone based on geographic location(s)

Description

The function determines the UTM zone for the mid-point of x.

Usage

epsg_for_utm(x, crs = 4326)

Arguments

x

A numerical two-dimensional object (a matrix, array, or data.frame) with longitude/X, latitude/Y as columns; a sp::SpatialPoints object; or a terra::SpatVector object; or a sf object with a point geometry, i.e., an object with a class sf or sfc.

crs

An object which is a crs or from which one can be derived. x can be numeric as a EPSG number; a character string as a wkt; a character string as a proj4 (not recommended because outdated); or of a class including raster::Raster, sp::Spatial, sp::CRS, or a sf or sfc class.

Value

The EPSG code as integer value.

References

The python package utm-zone by Per Liedman available at https://pypi.org/project/utm-zone.

See Also

utm_zone

Examples

locations <- matrix(
  data = c(-120.325, -111.245, 39.855, 36.753),
  nrow = 2
)

epsg_for_utm(locations)
sf::st_crs(epsg_for_utm(locations))


DrylandEcology/rSW2st documentation built on Jan. 10, 2024, 6:22 p.m.