
Get Stream Segments Upstream of a Network Position
Source:R/frs_network_upstream.R
frs_network_upstream.RdReturns all FWA stream segments upstream of a given blue line key and
downstream route measure. Uses the fwapg fwa_upstream() ltree comparison.
Usage
frs_network_upstream(
conn,
blue_line_key,
downstream_route_measure,
table = "whse_basemapping.fwa_stream_networks_sp",
cols = c("linear_feature_id", "blue_line_key", "waterbody_key", "edge_type",
"gnis_name", "stream_order", "stream_magnitude", "gradient",
"downstream_route_measure", "upstream_route_measure", "length_metre",
"watershed_group_code", "wscode_ltree", "localcode_ltree", "geom"),
wscode_col = "wscode_ltree",
localcode_col = "localcode_ltree",
include_all = FALSE
)Arguments
- conn
A DBI::DBIConnection object (from
frs_db_conn()).- blue_line_key
Integer. Blue line key of the reference point.
- downstream_route_measure
Numeric. Downstream route measure of the reference point.
- table
Character. Fully qualified table name. Default
"whse_basemapping.fwa_stream_networks_sp".- cols
Character vector of column names to select. Default includes the most commonly used FWA stream attributes.
- wscode_col
Character. Name of the watershed code ltree column. Default
"wscode_ltree". Use"wscode"for bcfishpass views.- localcode_col
Character. Name of the local code ltree column. Default
"localcode_ltree". Use"localcode"for bcfishpass views.- include_all
Logical. If
TRUE, include placeholder streams (999 wscode) and unmapped tributaries (NULL localcode). DefaultFALSEfilters these out. Only applied when querying the FWA base table.
See also
Other traverse:
frs_network(),
frs_network_downstream(),
frs_waterbody_network()
Examples
if (FALSE) { # \dontrun{
conn <- frs_db_conn()
# Get all streams upstream of a point on the Bulkley
upstream <- frs_network_upstream(conn,
blue_line_key = 360873822,
downstream_route_measure = 166030
)
# Use bcfishpass coho view
upstream <- frs_network_upstream(conn,
blue_line_key = 360873822,
downstream_route_measure = 166030,
table = "bcfishpass.streams_co_vw",
wscode_col = "wscode",
localcode_col = "localcode"
)
DBI::dbDisconnect(conn)
} # }