
Check user-input longitude and latitude values for validity
Source:R/internal_functions.R
dot-create_sf.RdConverts user-supplied locations (a named list, a data.frame or an
sf points object) into a validated sf points object in
the coordinate reference system of the packaged AEZ polygons. List and
data.frame coordinates are decimal degrees; if the AEZ coordinate
reference system is geographic they are used as supplied, otherwise they
are treated as WGS 84 and projected. The returned object always has a
character location column. Location names must be unique.
Usage
.create_sf(xy, locations = NULL, lonlat = NULL, call = rlang::caller_env())Arguments
- xy
User provided
list,data.frameor sf points object.- locations
The column (if a
data.frameorsfobject is provided) in which the location names are located, as anintegerindex or a column name. Defaults to1for adata.frame. For ansfobject, defaults to an existinglocationcolumn or, failing that, the row numbers.- lonlat
vector. A set of twointegerindices or column names indicating the columns of adata.framethat contain the longitude and latitude values. Defaults to2:3. Only used if adata.frameis provided.- call
The environment used for error reporting.
Value
An sf point object.