latlon2utm: Convert Lon/Lat to UTM

Description Usage Arguments Details Value References See Also Examples

View source: R/latlon2utm.R

Description

Convert longitude and latitude coordinates to Universal Transverse Mercator coordinates.

Usage

1
latlon2utm(lon, lat, zone = NULL, quiet = TRUE)

Arguments

lon

Numeric vector of longitudes.

lat

Numeric vector of latitudes, same length as lon.

zone

Numeric scalar of the UTM zone, default NULL. See details.

quiet

Logical scalar indicating whether to refrain from printing the determined zone when zone is NULL, default TRUE.

Details

If zone is NULL, then the zone is determined from the medians of lon and lat.

Value

A data frame with two columns (easting and northing) and as many rows as the length of lon containing the converted UTM coordinates in meters.

References

Based on a function posted by Stanislav on 13 May 2015 on stackoverflow [link].

See Also

lon2utmZone

Examples

1
2
3
4
5
6
mylon <- c(-92.11, -76.47, -82.27, -83.42)
mylat <- c(46.76, 44.34, 44.76, 45.41)
latlon2utm(mylon, mylat, quiet=FALSE)
sapply(1:length(mylon), function(i)
  latlon2utm(mylon[i], mylat[i], quiet=FALSE))
latlon2utm(mylon, mylat, 18)

JVAdams/EchoNet2Fish documentation built on Feb. 15, 2021, 4:27 a.m.