Skip to content

Distance to Outlet Returning 0 for entire stream network #359

Answered by dankovacek
dankovacek asked this question in Q&A
Discussion options

You must be logged in to vote

I'll answer my own question here in case someone else runs into this issue. The Distance to Outlet algorithm first looks for the outlet, then traverses upstream to calculate distances.

The script looks for outlet cells around line 308 in dist_to_outlet.rs by finding stream cells whose corresponding flow direction is 0 (directionless).

if dir > 0 {
    if dir > 128 || pntr_matches[dir] == 999 {
        return Err(Error::new(ErrorKind::InvalidInput,
            "An unexpected value has been identified in the pointer image. This tool requires a pointer grid that has been created using either the D8 or Rho8 tools."));
    }
} else {
    // It's an outlet; add it to the stack
    stack.push((row,

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dankovacek
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant