checkShore: Check Coordinates Near Shores

View source: R/checkShore.R

checkShoreR Documentation

Check Coordinates Near Shores

Description

Checks records whose coordinates fall in the sea, but close to the shoreline using different approaches.

Usage

checkShore(
  x,
  geo.check = "geo.check",
  lat = "decimalLatitude.new",
  lon = "decimalLongitude.new",
  type = "buffer",
  dist.max = 50,
  output = "new.col"
)

Arguments

x

a data frame with the species records

geo.check

character. Column with the result from the coordinate checking. Defaults to 'geo.check'

lat

character. Column with the corrected latitude to be checked. Defaults to 'decimalLatitude.new'

lon

character. Column with the corrected longitude to be checked. Defaults to 'decimalLongitude.new'

type

character. Type of approach to be used to flag records near the shore (see Details). Default to "buffer".

dist.max

numerical. Maximum distance (in kilometers) to detect records near to the shore. Default to 50 km.

output

a character string with the type of output desired: 'new.col' (new column with the result is added to the input data) or 'same.col' (results overwritten into column geo.check).

Details

Only coordinates flagged as 'sea' by the function checkCoord() are included in the verification. For all other coordinates, the function returns NA.

Two approaches can be used to detect coordinates in the sea but near to the shore, which are controlled by the argument type. The first one uses a 0.5 degree (~ 55 km in the Equator) buffer around the world map (type = 'buffer'). The second approach calculates the distance between the shore and the record (type = 'buffer'), in which the user can provide a maximum distance from the shore. This second approach, however, is much slower. For the record, rounding or imprecision of coordinates at the degree and minute levels can generate distance up to 130-157 km and 2.2-2.6 km, respectively, depending on the latitude considered.

Value

if output is 'new.col', a new column named 'shore.check' is added to the data, containing a TRUE/FALSE vector in which TRUE means coordinates close to the shore and FALSE means coordinate in open sea. If output is 'same.col', the column defined by geo.check is updated with a the previous class 'sea' is updated to 'shore' (records near the shore) and 'open_sea' (records far from the shore)

Author(s)

Andrea Sánchez-Tapia, Sara Mortara & Renato A. Ferreira de Lima


LimaRAF/plantR documentation built on Jan. 1, 2023, 10:18 a.m.