utm_convert: Convert a data.frame of UTM coordinates to an sf object with...

View source: R/utm-convert.R

utm_convertR Documentation

Convert a data.frame of UTM coordinates to an sf object with a single CRS

Description

This can operate on a data frame containing coordinates from multiple UTM zones with a column denoting the zone, or a single zone for the full dataset.

Usage

utm_convert(
  x,
  easting,
  northing,
  zone,
  crs = "EPSG:3005",
  datum = c("NAD83", "WGS84"),
  xycols = TRUE
)

Arguments

x

data.frame containing UTM coordinates, with a zone column

easting

the name of the 'easting' column

northing

the name of the 'northing' column

zone

the name of the 'zone' column, or a single value if the data are all in one UTM zone

crs

target CRS. Default BC Albers (EPSG:3005)

datum

The datum of the source data. "NAD83" (Default) or "WGS84"

xycols

should the X and Y columns be appended to the output? TRUE or FALSE

Details

It supports data collected in either the NAD83 or WGS84 ellipsoid in the Northern hemisphere

Value

sf object in the chosen CRS

Examples

# Data with multiple zones, and a column denoting the zone
df <- data.frame(
  animalid = c("a", "b", "c"),
  zone = c(10, 11, 11),
  easting = c(500000, 800000, 700000),
  northing = c(5000000, 3000000, 1000000)
)
utm_convert(df, easting = "easting", northing = "northing", zone = "zone")

# Data all in one zone, specify a single zone:
df <- data.frame(
  animalid = c("a", "b"),
  easting = c(500000, 800000),
  northing = c(5000000, 3000000)
)
utm_convert(df, easting = "easting", northing = "northing", zone = 11)

bcgov/bcmaps documentation built on Oct. 26, 2024, 10:26 p.m.