project_data: Project user-supplied locations

View source: R/project_data.R

project_dataR Documentation

Project user-supplied locations

Description

Given an input dataframe containing locations given in decimal degrees or meters (if projected), projects these locations and, if desired, appends them to the input dataframe. May also be used to back-project to Latitudes/Longitudes provided the input was projected using a Lambert azimuthal equal-area projection (CCAMLRp).

Usage

project_data(
  Input,
  NamesIn = NULL,
  NamesOut = NULL,
  append = TRUE,
  inv = FALSE
)

Arguments

Input

dataframe containing - at the minimum - Latitudes and Longitudes to be projected (or Y and X to be back-projected).

NamesIn

character vector of length 2 specifying the column names of Latitude and Longitude fields in the Input. Latitudes (or Y) name must be given first, e.g.:

NamesIn=c('MyLatitudes','MyLongitudes').

NamesOut

character vector of length 2, optional. Names of the resulting columns in the output dataframe, with order matching that of NamesIn (e.g., NamesOut=c('Y','X')).

append

logical (T/F). Should the projected locations be appended to the Input?

inv

logical (T/F). Should a back-projection be performed? In such case, locations must be given in meters and have been projected using a Lambert azimuthal equal-area projection (CCAMLRp).

See Also

assign_areas.

Examples



#Generate a dataframe
MyData=data.frame(Lat=runif(100,min=-65,max=-50),
                  Lon=runif(100,min=20,max=40))

#Project data using a Lambert azimuthal equal-area projection
MyData=project_data(Input=MyData,NamesIn=c("Lat","Lon"))
#View(MyData)


CCAMLRGIS documentation built on Sept. 27, 2023, 9:09 a.m.