filterByLand | R Documentation |
Identifies occurrence records that do not occur on land.
filterByLand(coords, crs = 4326)
coords |
coordinates in the form of a 2 column numeric matrix, data.frame, numeric vector, or spatial points object (sf or sp). If spatial object, crs must be defined. |
crs |
crs of input coords. Ignored if input coords are spatial object. |
This function uses a rasterized version of the GSHHG (global self-consistent, hierarchical, high-resolution geography database, https://www.soest.hawaii.edu/pwessel/gshhg/), that has been buffered by 2 km.
returns a logical vector where TRUE
means the point falls on
land.
Pascal Title
data(crotalus)
#identify points that fall off land
filterByLand(crotalus[,c('decimallongitude','decimallatitude')])
# testing different input options
samp <- sample(1:nrow(crotalus), 10)
xy <- crotalus[samp, c('decimallongitude', 'decimallatitude')]
sfpts <- sf::st_as_sf(xy, coords = c('decimallongitude', 'decimallatitude'), crs = 4326)
sfptsEA <- sf::st_transform(sfpts, crs = '+proj=eqearth')
spPts <- as(sfpts, 'Spatial')
filterByLand(xy)
filterByLand(sfpts)
filterByLand(sfptsEA)
filterByLand(spPts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.