
Create an sf object from UTM coordinates, handling multiple zones correctly.
Source:R/create_sf_from_utm.R
create_sf_from_utm.RdThis function takes a data frame with UTM coordinates (xcoord, ycoord) and a utmzone column, and creates an sf object with the correct CRS for each zone.
Examples
if (FALSE) { # \dontrun{
df <- data.frame(
xcoord = c(500000, 501000),
ycoord = c(5600000, 5601000),
utmzone = c(32, 32),
hemisphere = c("North", "North")
)
sf_obj <- create_sf_from_utm(df, output_crs = "EPSG:4326")
} # }