Skip to content

Add KNN snap params and split stream filtering guards#23

Merged
NewGraphEnvironment merged 5 commits intomainfrom
snap-enhancements
Mar 9, 2026
Merged

Add KNN snap params and split stream filtering guards#23
NewGraphEnvironment merged 5 commits intomainfrom
snap-enhancements

Conversation

@NewGraphEnvironment
Copy link
Copy Markdown
Owner

Summary

Test plan

  • All 226 tests pass (mock + live DB)
  • Roxygen docs regenerated
  • NEWS.md updated

Relates to NewGraphEnvironment/sred-2025-2026#16

🤖 Generated with Claude Code

NewGraphEnvironment and others added 5 commits March 8, 2026 21:11
When blue_line_key or stream_order_min is provided, bypass fwa_indexpoint()
and use KNN against fwa_stream_networks_sp with measure derivation and
boundary clamping (bcfishpass pattern). KNN path also filters out placeholder
streams (999 wscode), subsurface flow (edge_type 1410/1425), and unmapped
tributaries (NULL localcode).

Fixes #16
Fixes #17

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Filter out placeholder streams (999 wscode), subsurface flow (edge_type
1410/1425), and unmapped tributaries (NULL localcode) by default when
querying fwa_stream_networks_sp. Matches bcfishpass universal filter
pattern. Add include_all param to bypass when needed.

Applied to: frs_network_upstream(), frs_network_downstream(),
frs_network_prune(), frs_stream_fetch(), and frs_network() (both
direct and waterbody CTE paths).

Also replaces remaining %||% with if/else for R < 4.4 compatibility.

Fixes #15

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Closes #7
Closes #18

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Underground conduits (edge_type 1410) are real stream connectivity —
commonly decent streams that should not be filtered from network queries.
Split guards: .frs_stream_guards() excludes only placeholder (999 wscode)
and unmapped (NULL localcode); new .frs_snap_guards() adds subsurface
exclusion for KNN snap path where snapping to a culvert is not useful.

Relates to #15

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@NewGraphEnvironment NewGraphEnvironment merged commit aaf09c7 into main Mar 9, 2026
1 check passed
@NewGraphEnvironment NewGraphEnvironment deleted the snap-enhancements branch March 9, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant