latlon2utm: Convert Lon/Lat to UTM

View source: R/latlon2utm.R

latlon2utmR Documentation

Convert Lon/Lat to UTM

Description

Convert longitude and latitude coordinates to Universal Transverse Mercator coordinates.

Usage

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

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)


krphillips/EchoNet2Fish documentation built on March 19, 2022, 11:59 p.m.