R/LLtoUTM.R
LLtoUTM.Rd
The resulting units from applying the function are kilometers.
LLtoUTM(cm, lat, lon, xcol = "x", ycol = "y", minx = NULL, miny = NULL)
cm | is the user defined central median, often taken to be the mean of the longitude values |
---|---|
lat | is the vector of latitudes |
lon | is the vector of longitudes |
xcol | is the name of the output column of x coordinates |
ycol | is the name of the output column of y coordinates |
minx | is `NULL` by default |
miny | is `NULL` by default |
A list with the TM coordinates as the first component of the list. The first component of the list contains x coordinates in the first column and y coordinates in the second column
This function only needs to be used if the coordinates supplied by the user are latitude and longitude. If the coordinates are UTM, then we should not use this function.
## Add TM x and y coordinates to a data frame with ## latitude/longitude coordinates exampledataset$xc_TM_ <- LLtoUTM(cm = base::mean(exampledataset[ ,"xcoords"]), lat = exampledataset[ ,"ycoords"], lon = exampledataset[ ,"xcoords"])$xy[ ,1] exampledataset$yc_TM_ <- LLtoUTM(cm = base::mean(exampledataset[ ,"xcoords"]), lat = exampledataset[ ,"ycoords"], lon = exampledataset[ ,"xcoords"])$xy[ ,2]