Learn how to delineate streams and stream catchments from a digital elevation model in QGIS using SAGA tools.
Add SAGA tools to QGIS: https://youtu.be/18U5AJgPMok
Download topography: https://youtu.be/JJFBEsNUCnw
Delineate streams with GRASS: https://youtu.be/ECvew8FeSg4
Check out my website for more: https://opensourceoptions.com
Show More Show Less View Video Transcript
0:01
Hi folks, welcome to open source
0:03
options. In the last video, I showed you
0:05
how to delineate stream channels using
0:09
NQGIS using the grass tools. Today,
0:12
we're going to go through the same
0:14
process, but this time using the Saga
0:16
tools, which I do prefer just a little
0:19
bit. Now, before we get started, there
0:21
are two things you need to do. First,
0:23
you need to make sure you have a digital
0:25
elevation model um available and
0:27
pre-processed. By pre-processed, I mean
0:29
clipped to your area of interest and
0:32
projected into into a projected
0:34
coordinate reference system like UTM
0:37
coordinates for example. Uh you can see
0:39
I have that here. I'm doing this for a
0:41
small area so the operations run quickly
0:43
and you don't spend a lot of time
0:45
waiting for my computer to run tasks.
0:47
The second thing you need to have is you
0:50
need to have the Saga nextg tool set
0:52
added to QGIS. Now, these tools come
0:56
pre-installed with QGIS, but they're not
0:58
added to the processing toolbox by
1:00
default. It's very easy to do, and I
1:03
have a video that shows you how to do
1:05
it, and I will link that in the
1:07
description. In the description, I will
1:09
also link a video showing you how you
1:11
can go and download elevation data um
1:14
online if you want to use data from the
1:17
US Geological Survey.
1:20
Now that we have those things
1:21
established, let's go ahead and get
1:22
started processing uh our digital
1:25
elevation model to create stream
1:27
channels. We're going to open the saga
1:30
nextG tools. We're going to come down to
1:33
terrain analysis and open this. And here
1:36
we are going to use the fill syncs tool.
1:39
We can use fill syncs or fill syncs XXL.
1:42
It doesn't really matter. So let's start
1:44
out with fill syncs. We're going to
1:47
change this minimum slope degree to 0
1:50
uh01
1:53
just to ensure that uh we don't have any
1:57
flat areas. We only need to save the
2:00
field dem. I will save this to a file.
2:03
You will notice that when you save this,
2:06
you're only allowed you're only able to
2:07
save this as an estat file um or the
2:10
SAGA data file. That's just fine. We'll
2:13
use that format. And I'm going to call
2:15
this field_YT
2:17
for the YouTube demonstration. We will
2:19
now click save. And we can save these
2:24
other files if we want, but I'm just
2:25
going to turn those off. We don't need
2:27
them for the remainder of uh this
2:31
tutorial. Let's go ahead and click run.
2:34
This will calculate relatively quickly
2:36
on the small DEM I have. And there you
2:39
can see that we now have this field DEM
2:42
available.
2:43
With this field DEM we can now move on
2:46
to calculating the flow accumulation.
2:49
Um you can see there are different
2:51
options available here. Um you can
2:54
really choose any of these. We'll take a
2:57
look at these. If we have the one step
2:59
um you can see we have options for
3:01
pre-processing and sync removal. Um
3:06
we can do a recursive version which
3:09
gives us uh we can add weights into
3:12
that. Um
3:15
we have different options here. The one
3:17
that I generally use is just this
3:18
parallelizable one. It's a very simple
3:21
one to use. We just give it our field
3:24
elevation model. We choose a method. We
3:27
can choose D8, D infinity or multiple
3:30
flow direction. Um let's just go ahead
3:32
and do D8. It's probably the simplest of
3:34
all those. If you're not sure about the
3:36
differences between D8, D infinity, and
3:38
MFD, and you want to know, um, leave a
3:41
comment below and I can do a video on
3:43
that. And now we'll save this to a file.
3:46
We'll save this to accumulation_YT
3:51
or the YouTube tutorial. Now, let's go
3:54
ahead and click run and wait for this to
3:58
complete. It's going to take a number of
3:59
passes to complete. You can see that it
4:01
took 690 passes and it happened very
4:04
quickly on the small area that we used
4:06
here. If we zoom in, we can see those
4:10
flow paths coming in nicely uh from our
4:14
flow accumulation.
4:15
Now the next thing we need to do is
4:18
determine a threshold to use uh to
4:22
determine where our stream channels will
4:24
be.
4:25
The way I like to do this is I go to
4:28
raster and raster calculator and I'll
4:30
take my accumulation and I'll use the
4:32
greater than operator to find where the
4:35
accumulation is greater than a certain
4:36
value. Let's try 100,000 to start.
4:40
And we can create an on the-fly raster
4:43
here. And so we can click okay. And that
4:46
gives us this channel network here. Um,
4:49
that might be a little bit too uh
4:54
generous of a channel layer. So, let's
4:55
remove that. And let's come back in and
4:59
do this again. And uh let's try this
5:04
with
5:06
a value of 1 million.
5:10
And we'll do it on the fly again. We'll
5:12
say okay.
5:15
And that's, you know, getting closer to
5:19
correct. Another way I'll show you that
5:21
we can do this. I'm going to remove this
5:27
is there's two ways. So one is we can
5:29
use this value tool and we can see our
5:31
values here, our accumulation. We can
5:34
come in and we can find about where we
5:36
want this to be. We can see that here we
5:39
are at uh
5:43
that look like it's about 10 million
5:45
there. Uh our symbology is not great
5:48
here. If we wanted to include this
5:50
channel down here, you can see we need
5:53
to be at about 500,000 to include that.
5:57
Um so maybe we'll use a threshold of
5:59
500,000.
6:00
The way we can check this without doing
6:02
the calculation is we can come in and we
6:06
can change this to single band pseudo
6:10
color. Uh you can see here we have the
6:13
spectral color ramp or the turbo color
6:14
ramp. We can change this to equal
6:18
interval. Uh we can classify it.
6:22
Then what I would do is I would come
6:23
down and make this value about 1,000.
6:26
Then make this one about 10,000.
6:29
We're essentially creating a log scale
6:31
here. Make this about 100,000
6:36
and then do
6:38
about 1 million.
6:41
And then the next one I would do at 10
6:43
million.
6:47
Okay. And now we can break that out in
6:49
the log scale. And we can come down and
6:51
see where our channels are. And we can
6:54
then in association use our value tool
6:56
to come in and get a cut off here. So we
6:58
could do a cutoff of about 450,000
7:02
would get us this channel coming in
7:05
here. So let's try 450,000 based on
7:08
that. And to do that to get our channels
7:11
we can now come back to the processing
7:13
toolbox
7:15
and we can do the channel network here.
7:18
So we'll choose channel network. We're
7:19
going to input our elevation which is
7:21
our field flow direction. Our initiation
7:24
grid is accumulation. We want where
7:27
values are greater than we said 450,000
7:33
and we can leave all these defaults.
7:38
Now you'll notice we have three output
7:40
files. We have a channel network, a
7:42
channel direction and a channel network.
7:44
There are two channel network files. One
7:46
is a raster file and one is a vector
7:49
file. I I wish there was a little more
7:52
direction about which was which. Uh this
7:56
is says shapes. Look at the Python
7:58
identifier. So this is probably going to
7:59
be our line. Um so we this is what we
8:02
want to save.
8:04
We'll save this file. It's going to be a
8:06
shape file. And we click on that. So
8:08
this is going to be our uh channel
8:12
network. We'll call that channel
8:15
YouTube. And we'll click save. And we'll
8:19
not save these, but we will add them so
8:23
you can see what they look like. Let's
8:25
go ahead and click run. And this will
8:28
quickly extract those channels for us.
8:30
Now we can close this.
8:34
Let's turn off our accumulation.
8:38
And
8:40
here you can see we have our channel
8:41
network. Let's just change the symbology
8:44
there so that it's blue like streamlines
8:46
would be.
8:48
Just pop it over here.
8:51
Okay, good. And now we can turn this
8:54
off. You can see our channel direction
8:57
raster here. And if we go to our value
8:59
tool, you'll see that we've get channel
9:02
direction
9:03
and channel network.
9:06
We have
9:08
just values here. And those values, I
9:10
think, are D8 values indicating which
9:12
way the channel flows. So you could
9:13
trace it if you would like. And then our
9:16
channel network values. If we turn this
9:17
off, we just have unique values for each
9:20
channel segment on there. So here, these
9:22
are all two. If we come up to this here,
9:26
these are all one, these are negative
9:29
one, which is going to indicate some
9:31
kind of connection. It's going to
9:32
indicate those connect to a different
9:34
one here because you can see we get
9:36
negative one values here also. Okay, so
9:39
that's how those are the kind of
9:40
intermediate layers used to connect the
9:43
channels. All right, but there you have
9:45
it. I'm going to turn this off. I'm
9:46
going to turn our channel
9:49
network back on. And you can see we've
9:51
created that channel network. Now,
9:52
really quick, let's take a look at the
9:54
attribute table.
9:57
Uh,
9:58
open the attribute table. Here we go.
10:00
You can see we have three columns. We
10:04
have a segment ID. If we scroll down,
10:06
those are all going to be ones.
10:09
We have an order, which is going going
10:11
to kind of tell us in the drainage
10:13
network where these are. ones are
10:15
headwaters. Twos happen when you have
10:17
two ones that connect. Um and so on. And
10:20
then we have a length um for each of
10:23
these. These lengths are a little
10:28
I don't think that's actually the length
10:30
of
10:31
the
10:33
segment because these appear to be we
10:37
have 10 here. These appear to be it's
10:39
either one cell width or a diagonal cell
10:42
width. Um, this would be uh 10 times the
10:46
square t of two.
10:50
Um, anyway,
10:52
so that's kind of strange that they have
10:55
that done that way, but this stream
10:57
order here can be useful. And in fact,
10:59
in an upcoming video here, I'll show you
11:01
how you can use stream order to uh
11:05
symbolize
11:07
your streams based on their size in the
11:10
network. So streams at the bottom of the
11:12
network will be wider than streams at
11:14
the top of the network. And it's really
11:15
easy to symbolize that way if you have
11:17
an attribute like channel order. Okay.
11:21
Well, thanks for watching folks. I hope
11:22
you have found this useful and
11:24
insightful. Uh and between this video
11:27
and the last one, I hope you're able to
11:28
create your own stream network and
11:31
stream channels using these available
11:34
QGIS tools. Actually, before we get
11:36
finished, let's try one more thing. I
11:38
want to show you one more thing here. um
11:40
we use this channel network. We can also
11:42
do channel network on drainage basins.
11:44
Let's give that a try and just make sure
11:46
it works out well. So here we want to
11:48
grab our field layer.
11:51
We don't need our flow direction. We
11:53
don't need connectivity or straer order.
11:55
We don't need these are all optional
11:57
outputs. we basically input our filled
12:02
um
12:04
elevation model and then
12:08
we have all these other layers that get
12:09
output. We have our channels, we have
12:11
our drainage basations and our
12:12
junctions. So this gives us even more
12:14
information than just the stream
12:17
channels. But let's go ahead and click
12:20
run and take a look at the outputs we
12:23
get here.
12:25
Okay, so that's completed.
12:28
And here you can see we get these
12:30
drainage basins. Some of these drain
12:32
outwards and so we don't get a full
12:33
basin on them. We can pop these channels
12:36
up on top here. And you can see we get
12:40
uh those same channels to a degree.
12:44
And I should make this a little more
12:47
give this a little more contrast.
12:49
I'm going to give it a different color
12:51
than our others. We can keep it
12:53
straight. We'll do red.
12:55
Just make it a little bit
12:58
uh thicker. Okay. And so there you can
13:01
see that we now have these drainage bas
13:04
basins for each channel segment. And
13:07
this can be really useful if you're
13:08
trying to do some kind of modeling. We
13:12
also get uh junctions uh which can also
13:16
be useful for modeling. Okay. So just to
13:21
show you that there are multiple ways to
13:23
calculate this with uh and multiple data
13:27
levels you can capture when you do this
13:30
with Saga. All right, thanks for
13:32
watching. I just want to sneak in that
13:33
one last little demonstration that some
13:35
of you might find useful. I hope you've
13:38
enjoyed this. If you have questions,
13:40
leave comments. If there are other
13:42
videos you want to see, leave comments
13:44
and I'll catch you in the next video.
