
Emit slim crossings_lookup + per-source barriers_* tables
Source:R/lnk_barriers_emit.R
lnk_barriers_emit.RdGiven a <schema>.crossings table (bcfp-shaped — produced upstream by
lnk_pipeline_crossings() or by loading a bcfp-format external dump)
plus optional <schema>.dams, emits five derived tables via filtered
SELECTs:
Details
<schema>.crossings_lookup(slim id + status projection)<schema>.barriers_anthropogenic(all barrier-status crossings)<schema>.barriers_pscis(PSCIS-sourced barrier-status crossings)<schema>.barriers_dams(dam-sourced barrier-status crossings)<schema>.barriers_remediations(anthropogenic UNION REMEDIATED-PASSABLE)
Output column shapes match what lnk_pipeline_access(barrier_sources = list(...))
consumes — aggregated_crossings_id plus the network-position columns
(linear_feature_id, blue_line_key, downstream_route_measure,
wscode_ltree, localcode_ltree).
Mostly bcfp-shape-specific — it relies on column names/values from
bcfp's crossings shape (barrier_status, crossing_source,
pscis_status). Lives in link as the emit step of the new
lnk_pipeline_crossings() phase; may move to a future pac package
once that's scaffolded.
Filters mirror bcfp's model/01_access/sql/barriers_*.sql and
remediations_barriers.sql:
barrier_status IN ('BARRIER', 'POTENTIAL')for anthropogenic-style tables.blue_line_key = watershed_key(excludes side-channel features).barriers_remediations=barriers_anthropogenicUNION crossings WHEREpscis_status = 'REMEDIATED' AND barrier_status = 'PASSABLE'(bcfp-intended logic per the v0.30.2 fix; seesmnorris/bcfishpass#891).
See also
Other barriers:
lnk_barriers_unify(),
lnk_barriers_views()
Examples
if (FALSE) { # \dontrun{
conn <- lnk_db_conn()
lnk_pipeline_setup(conn, schema = "working_adms")
# ... lnk_pipeline_crossings(...) populates working_adms.crossings ...
lnk_barriers_emit(conn, schema = "working_adms")
DBI::dbReadTable(conn, c("working_adms", "crossings_lookup"))
} # }