Latitude and Longitude coordinates are converted to TM projection coordinates with a user-defined central meridian. The resulting units from applying the function are kilometers.
cm: is the user defined central median. A common choice is the mean of the longitude values in your data set
lat: is the vector of latitudes
lon: is the vector of longitudes
xcol: is the name of the output TM column of x coordinates
ycol: is the name of the output TM column of y coordinates
minx: is NULL by default and sets the minimum x-coordinate value to 0. This is an optional minimum value for the x-coordinate vector.
miny: is NULL by default and sets the minimum y-coordinate value to 0. This is an optional minimum value for the y-coordinate vector.
Returns
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. The remaining elements of the list are the cm, minx, and miny values that were input.
Details
This function only should only be used if the coordinates supplied by the user are latitude and longitude. The default TM projection here specifies that both the minimum x and y-coordinate values are 0 scaled to 1 km.
Examples
## Add transverse Mercator x and y coordinates to a data frame with## latitude/longitude coordinates. Name these \code{xc_TM_} and \code{yc_TM_}.exampledataset$xc_TM_ <- LLtoTM(cm = base::mean(exampledataset[,"xcoords"]), lat = exampledataset[,"ycoords"], lon = exampledataset[,"xcoords"])$xy[,1]exampledataset$yc_TM_ <- LLtoTM(cm = base::mean(exampledataset[,"xcoords"]), lat = exampledataset[,"ycoords"], lon = exampledataset[,"xcoords"])$xy[,2]