View source: R/ifcb_is_near_land.R
ifcb_is_near_land | R Documentation |
Determines whether given positions are near land based on a land polygon shape file.
The Natural Earth 1:10m land vectors are included as a default shapefile in iRfcb
.
ifcb_is_near_land(
latitudes,
longitudes,
distance = 500,
shape = NULL,
source = "ne",
crs = 4326,
remove_small_islands = TRUE,
small_island_threshold = 2e+06,
plot = FALSE,
utm_zone = deprecated()
)
This function calculates a buffered area around the coastline using a polygon shapefile and determines if each input position intersects with this buffer or the landmass itself. By default, it uses the Natural Earth 1:10m land vector dataset.
The EEA shapefile is downloaded from https://www.eea.europa.eu/data-and-maps/data/eea-coastline-for-analysis-2/gis-data/eea-coastline-polygon
when source = "eea"
.
If plot = FALSE
(default), a logical vector is returned indicating whether each position
is near land or not, with NA
for positions where coordinates are missing.
If plot = TRUE
, a ggplot
object is returned showing the land polygon, buffer area,
and position points colored by their proximity to land.
# Define coordinates
latitudes <- c(62.500353, 58.964498, 57.638725, 56.575338)
longitudes <- c(17.845993, 20.394418, 18.284523, 16.227174)
# Call the function
near_land <- ifcb_is_near_land(latitudes, longitudes, distance = 300, crs = 4326)
# Print the result
print(near_land)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.