zone_from_ll: Find the UTM zone for a given location

Description Usage Arguments Details Value References Examples

View source: R/s1_proc_inputs.R

Description

This function returns the UTM zone for a given set of latitude/longitude.

Usage

1
zone_from_ll(lon, lat)

Arguments

lon

A numeric vector of longitudes

lat

A numeric vector of latitudes

Details

This function takes a point and calculates the correct UTM zone in which that point falls. It was developed based on answers to a Stack Overflow post (see below).

Value

Returns an integer vector of UTM zones the same length as the inputs lon and lat

References

Based on the answers to the Stack Overflow post found here:
https://stackoverflow.com/questions/9186496/determining-utm-zone-to-convert-from-longitude-latitude

Examples

1
2
3
4
5
6
7
8
#UTM grid for Ft. Lauderdale, FL, USA
zone_from_ll(lon = -80.15, lat = 26.133333)

#UTM grid for Rome, Italy; Paris, France; London, UK
ll_df <- data.frame(city = c("Rome", "Paris", "London"),
                    lon = c(12.5, 2.3508, -0.1275),
                    lat = c(41.9, 48.8567, 51.507222))
zone_from_ll(lon = ll_df$lon, lat = ll_df$lat)

bsmity13/ADePTR documentation built on Nov. 9, 2019, 12:43 a.m.