Skip to contents

Generate depth points for interpolation

Usage

generate_depth_points(
  shoreline,
  islands = NULL,
  point_data = NULL,
  contours = NULL,
  res = 2,
  subsample = TRUE,
  crs = NULL
)

Arguments

shoreline

sf object of lake shoreline.

islands

sf object of lake islands if present.

point_data

sf object of depth points or a dataframe of points with columns 'lon' and 'lat'. Must contain a "depth" column. If NULL, then contours must be provided. If NULL, then contours must be provided.

contours

sf object of depth contours. If NULL, then points must be provided.

res

numeric resolution of output raster in metres.

subsample

logical subsample points to 10000 if TRUE. Default is TRUE.

crs

target coordinate reference system: object of class crs, or input string for st_crs

Value

sf object of depth points.

Examples

shoreline <- readRDS(system.file("extdata/rotoma_shoreline.rds",
package = "bathytools"))
point_data <- readRDS(system.file("extdata/depth_points.rds",
package = "bathytools"))

# Generate depth points with points ----
depth_points <- generate_depth_points(shoreline = shoreline,
point_data = point_data)
#> Generating depth points... [2024-11-13 23:08:38]
#> Finished! [2024-11-13 23:08:38]

# Generate depth points with contours ----
contours <- readRDS(system.file("extdata/depth_contours.rds",
package = "bathytools"))
depth_points <- generate_depth_points(shoreline = shoreline,
contours = contours)
#> Generating depth points... [2024-11-13 23:08:38]
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: repeating attributes for all sub-geometries for which they may not be constant
#> Warning: large number of points for interpolation (100695)
#> Finished! [2024-11-13 23:08:42]