
Extract shoreline from a bathymetric raster using a contour threshold
Source:R/generate_shoreline_from_bathy.R
generate_shoreline_from_bathy.RdThis function identifies land areas from a bathymetric raster by applying a
contour threshold, converts the result into polygon geometry, and optionally
saves it to a shapefile. If contour is greater than the max value in
bathy a warning is displayed and contour is set to the max value from
bathy
Usage
generate_shoreline_from_bathy(
bathy,
contour,
save_output = FALSE,
filename = "shoreline.shp"
)Arguments
- bathy
A
SpatRasterobject representing bathymetric or elevation data.- contour
A numeric value representing the elevation threshold to define land.
- save_output
Logical. If
TRUE, the output polygon will be saved to a shapefile. Default isFALSE.- filename
A string giving the name of the shapefile to save if
save_output = TRUE. Default is"shoreline.shp".