Learn R Programming

Tivy (version 0.1.1)

land_points: Points on land

Description

Classifies a set of geographic coordinates (longitude and latitude) as "land" or "sea" according to their relative position to a coastline. A point is considered to be on land if its longitude is greater than that of its nearest point on the coastline.

Usage

land_points(
  x_point,
  y_point,
  coastline = NULL,
  parallel = FALSE,
  cores = 4,
  distance_type = "haversine",
  window = 0.5,
  unit = "nm"
)

Value

Text vector of the same length as x_point, indicating whether each point is on "land" or "sea". NA values are maintained as NA.

Arguments

x_point

Numeric vector of longitudes (in decimal degrees).

y_point

Numeric vector of latitudes (in decimal degrees).

coastline

Data frame with coastline coordinates. Must have columns named Long and Lat. If NULL, uses internal dataset peru_coastline.

parallel

Logical. If TRUE, performs the calculation in parallel using multiple cores.

cores

Number of cores to use for parallel processing.

distance_type

Type of geodesic distance to use in the calculation.

window

Geographic window in degrees to reduce the number of coastline points to consider.

unit

Unit of measurement for distance: "km" or "nm".

Examples

Run this code
if (FALSE) {
data_hauls <- process_hauls(data_hauls = calas_bitacora)
result <- land_points(
  x_point = data_hauls$lon_final,
  y_point = data_hauls$lat_final
)
table(result)
}

Run the code above in your browser using DataLab