Skip to contents

Converts 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.frame or sf points object.

locations

The column (if a data.frame or sf object is provided) in which the location names are located, as an integer index or a column name. Defaults to 1 for a data.frame. For an sf object, defaults to an existing location column or, failing that, the row numbers.

lonlat

vector. A set of two integer indices or column names indicating the columns of a data.frame that contain the longitude and latitude values. Defaults to 2:3. Only used if a data.frame is provided.

call

The environment used for error reporting.

Value

An sf point object.