Skip to content

Comments

r.stream.extract: solve ties of equal flow accumulation#6554

Merged
petrasovaa merged 1 commit intoOSGeo:mainfrom
metzm:r.stream.extract_6541
Oct 28, 2025
Merged

r.stream.extract: solve ties of equal flow accumulation#6554
petrasovaa merged 1 commit intoOSGeo:mainfrom
metzm:r.stream.extract_6541

Conversation

@metzm
Copy link
Contributor

@metzm metzm commented Oct 26, 2025

In case of constant flow accumulation, e.g. to mask out areas where no streams should be traced, the flow direction method fails. With this PR, cases of equal flow accumulation are solved by following elevation.

Fixes #6541

@metzm metzm added this to the 8.5.0 milestone Oct 26, 2025
@metzm metzm requested a review from petrasovaa October 26, 2025 12:44
@metzm metzm added bug Something isn't working raster Related to raster data processing C Related code is in C module labels Oct 26, 2025
Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense and it does fix the issue. See my question about #6543.

@petrasovaa petrasovaa merged commit c12f54c into OSGeo:main Oct 28, 2025
27 checks passed
petrasovaa added a commit that referenced this pull request Oct 28, 2025
…obust (#6543)

This block got removed as part of compiler warnings cleanup #1248, but the removal broke special cases (#6541).
The intention of r.stream.extract is to use external flow accumulation for stream extraction, but if in doubt follow the A* search direction, i.e. if (fabs(wat_nbr[np_side]) >= max_acc).
Restoring this deleted code block in addition to #6554 should make r.stream.extract robust for special cases as reported in #6541.
@metzm metzm deleted the r.stream.extract_6541 branch October 28, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working C Related code is in C module raster Related to raster data processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Cross-flow issue from the r.stream.extract function

2 participants