Skip to contents

Get contours from a bathymetric raster

Usage

get_contours(bathy_raster, surface = 0, depths = NULL)

Arguments

bathy_raster

SpatRaster object with bathymetry depths (negative values).

surface

numeric. The surface elevation of the lake. Default is 0.

depths

numeric. The depths at which to calculate the area. If a single numeric value is provided, the function will calculate the area at each depth from the surface to the minimum depth of the bathymetry raster at intervals of the provided value. If a vector of numeric values is provided, the function will calculate the area at each depth specified in the vector. if NULL, the function will use the default depths from the model layer structure. Default is NULL.

Value

sf LINESTRING of the contours.

Examples

shoreline <- readRDS(system.file("extdata/rotoma_shoreline.rds",
package = "bathytools"))
depth_points <- readRDS(system.file("extdata/depth_points.rds",
package = "bathytools"))
bathy_raster <- rasterise_bathy(shoreline = shoreline,
depth_points = depth_points, crs = 2193, res = 8)
#> Generating depth points... [2025-08-25 02:34:57]
#> Finished! [2025-08-25 02:34:57]
#> Interpolating to raster... [2025-08-25 02:34:57]
#> Adjusting depths >= 0 to  -0.82 m
#> Finished! [2025-08-25 02:34:58]

contours <- get_contours(bathy_raster = bathy_raster)