View source: R/ch_wbt_pourpoints.R
ch_wbt_pourpoints | R Documentation |
Pour points describe the outlets of sub-basins within a DEM. To use the pour points to delineate catchments, they must align with the drainage network. This function snaps (forces the locations) of pour points to the channels.
ch_wbt_pourpoints( pp_sf = NULL, fn_flowacc, fn_pp, fn_pp_snap, check_crs = TRUE, snap_dist = NULL, ... )
pp_sf |
sf object containing pour points. These must be supplied by the user. See
the code in |
fn_flowacc |
Name of file containing flow accumulations. |
fn_pp |
File name to create un-snapped pour points. |
fn_pp_snap |
File name for snapped pour points. |
check_crs |
If |
snap_dist |
Maximum snap distance in map units. |
... |
Additional parameters for whitebox function |
Returns a sf object of the specified pour points snapped to the channel network.
Dan Moore
ch_volcano_pourpoints
# Not tested automatically as requires installation of Whitebox library(raster) test_raster <- ch_volcano_raster() dem_raster_file <- tempfile(fileext = c(".tif")) no_sink_raster_file <- tempfile("no_sinks", fileext = c(".tif")) # write test raster to file writeRaster(test_raster, dem_raster_file, format = "GTiff") # remove sinks removed_sinks <- ch_wbt_removesinks(dem_raster_file, no_sink_raster_file, method = "fill") # get flow accumulations flow_acc_file <- tempfile("flow_acc", fileext = c(".tif")) flow_acc <- ch_wbt_flow_accumulation(no_sink_raster_file, flow_acc_file) # get pour points pourpoint_file <- tempfile("volcano_pourpoints", fileext = c(".shp")) pourpoints <- ch_volcano_pourpoints(pourpoint_file) snapped_pourpoint_file <- tempfile("snapped_pourpoints", fileext = c(".shp")) snapped_pourpoints <- ch_wbt_pourpoints(pourpoints, flow_acc_file, pourpoint_file, snapped_pourpoint_file, snap_dist = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.