w_intersect: Intersect a river feature with a polygon feature

View source: R/intersect.r

w_intersectR Documentation

Intersect a river feature with a polygon feature

Description

w_intersect handles the use case where we want to summarize areal features, such as land use, soils, etc, across reaches of a river, while taking into account drainage area, flow, etc.

Usage

w_intersect(
  riv,
  areas,
  area_id = NULL,
  drainage,
  pts,
  buff = 50,
  rid = "reach_id"
)

Arguments

riv

An sf LINESTRING layer, the river channel

areas

Areal features to summarize; see 'details.'

area_id

Optional character vector giving field/column names that should be summarised; see 'details.'

drainage

Drainage direction raster for calculating catchment

pts

An sf point layer, one point per reach; the locations to compute the catchment of each reach. If missing, the last point in each reach in riv is used.

buff

Buffer width

rid

The column name in 'riv' containing reach ID numbers

Details

There are three output types:

  • riparian: The layers in areas are summarized within a riparian buffer around each reach

  • riparian_upstream: The layers in areas are summarized within a riparian buffer for each focal reach and all upstream reaches

  • catchment: The layers in areas are summarized within the entire catchment for each reach

areas must be in one of the following formats: terra::SpatRaster, raster::raster, sp::SpatialPolygons, or sf::sf. Multiple features are allowed, in which case provide a raster stack/multi band raster, or a list of polygon features.

If polygon features are specified in areas, you must also specify which attributes should be summarised in area_id. Currently a single attribute per feature is supported, and it must be specified by name, not column index. Partial matching with regular expressions is allowed, but each item in area_id must identify a single column in areas. Ignored if areas is a raster.

Value

A data.table summarising the polygons in each layer in areas along the river provided in x.


flee-group/watershed documentation built on July 25, 2022, 12:46 p.m.