How to extract a river profile from a DEM using ArcMap?
IMPORTANT: place your DEM and all the files that you will create in a UNIQUE
directory that will not move for a while. If you move something, it becomes very difficult
(impossible?) to access it from ArcMap. You CANNOT overwrite files created with ArcMap:
once you have created a file, you cannot create another file with the same name.
You will need up to 30 Mb of free space on your disk.
The practical is based on using ArcMap which you should begin to become familiar with.
For all the commands, you can use the “help” command which is really helpful and well
I. Extracting the catchment(s) with ArcMap
If you haven’t done it already, download the DEM of the studied catchment (“elriver”) in
the “Practical 3” folder on WebCT. Place it in a new “exercise4” folder. Open ArcMap and
import the DEM by clicking the button “add data” (the plus on the yellow square ). You
will have to connect to your “exercise4” folder to get the DEM: click on the button “connect
to folder” (the arrow on the globe).
You will work with 2 types of objects: grid (= raster) and coverage (= vectors).
If something doesn’t work in ArcMap, make sure that the commands are activated: go to
“Tools” “Extensions” tick the boxes that you need (in our case, “3D analyst”,
“geostatistical analyst” and “spatial analyst” are the ones that we use). Since you used
ArcMap already, I guess that you have already done it.
IMPORTANT: you can be lost very quickly, submerged by the number of files that you
will create. I suggest that for each file name, you use a prefix that refers to the area that
you are studying (or the exercise number) and a suffix that refers to the type of data.
Example: you can use the prefix “ex4”. “ex4_hillshd” will be the hillshade file of the area,
“ex4_flowdir” will be the flow direction file, etc.
On the left of the ArcMap window, the “layers” window shows the different layers
displayed. You can hide them, move them up or down, or change their properties by clicking
on their name: CAUTION, click and double-click do different things! When you remove
something from ArcMap, the file itself is not deleted: you can import it again if you want. If
you want to use a file as an input file for a command, you must add it in ArcMap using the
“add data” button first (but you can hide it if you want). If the “Toolbox” window is not open
already, open it by clicking on the red toolbox. In what follows, if nothing is specified for an
ArcMap command, it means that it can be found in the Toolbox window.
Note: don’t forget to save your ArcMap file from time to time.
1. Set Null: as for the 1st practical, the “no data” points in the DEM have been replaced by
ridiculously high or low elevation values. To get rid of them: Spatial Analyst Tools
Conditional Set Null. Choose your DEM “elriver” as the input raster (2 first rows), give an
output name (“ex4_DEM” for example) and write in the expression line (case sensitive):
Value < -1000 AND Value > 2000
This way, the values of elevation which are unrealistic (elevation lower than -1000 m and
higher than 2000 m – we are looking at Scotland today) will be set to Null. You should now
be able to see the topography now.
2. Fill: it is important to fill the sinks in the DEM (rivers don’t go uphill: they fill sinks).
Spatial Analyst Tools Hydrology Fill. You will generate an “ex4_fill” raster that will be
used in what follows. You can remove the initial “ex4_DEM” raster from ArcMap to make
sure that you do not use it by mistake.
3. Hillshade: this command is not in the Toolbox window. Click the “Spatial Analyst”
button surface analysis Hillshade: use “ex4_fill” as the input file. Specify an output file
instead of “temporary”: “ex4_hillshd”.
4. Flow direction: Spatial Analyst Tools Hydrology Flow direction: generate
“ex4_flowdir” using “ex4_fill” as the input raster.
5. Flow accumulation: Spatial Analyst Tools Hydrology Flow accumulation:
generate “ex4_flowacc” using “ex4_flowdir” as the input raster.
6. Define the stream network: it is defined by the application of a condition: flow
accumulation > a given value. Spatial Analyst Tools Conditional Con. Choose your
flow accumulation raster “ex4_flowacc” as the input raster (2 first rows), give an output name
(“ex4_strmnet” for example) and write in the expression line (case sensitive):
Value > 100
This means that in the new raster “ex4_strmnet”, only the pixels in the landscape which
have a flow accumulation > 100 (that is, the pixels that have more than 100 pixels draining
into them) will be kept. All the other pixels will be given a Null value. If you find that the
stream network is too dense, repeat the operation with a larger number, and vice-versa (100
should work in your case).
To actually define the network: Spatial Analyst Tools Hydrology Stream order: use
the “ex4_strmnet” raster that you have just generated as the input stream raster, “ex4_flowdir”
as the flow direction raster, and generate an “ex4_strmorder” raster.
To turn the network into a coverage (= vectors): Spatial Analyst Tools Hydrology
Stream to Feature: use the “ex4_strmorder” raster that you have just generated as the input
stream raster, “ex4_flowdir” as the flow direction raster, and generate a “ex4_strmline” raster.
If you hide everything but the hillshade of the DEM and the stream coverage that you have
just produced, you should see something like that (the DEM quality is not fantastic, hence the
strange parallel lines):
7. Extract the catchment: to do so, we need to specify a pour point. We are going to tell
ArcMap “this is the outlet of the catchment: we want you to show us the contributing area
draining into this pixel”. What we will do know is very similar to the part “D. Extracting river
transects” from the 1st practical. Please refer to these notes if what follows is not clear:
First you will create a new shapefile. These are files that contain points, lines, polygons,
etc in the software. Go to ArcCatalog, navigate to your folder “exercise4” and from the menu,
go to File New Shapefile. Give a name, e.g. “ex4_pourpoint”, keep the feature type as
“Point” and DON’T FORGET TO SPECIFY A COORDINATE SYSTEM: at the moment,
the coordinate system is unknown and if you don’t specify it, what follows will just fail. Click
on “Edit”, then on “Import”. Then, select any of the rasters that you have been using today,
e.g. “ex4_fill”. Click “OK”, then the coordinate system should appear. You can now click
“OK”: your shapefile “ex4_pourpoint” now exists.
Go back to ArcMap and add the shapefile: click on the “add data” button (the plus sign on
the yellow square) and select the file. “ex4_pourpoint” should appear in the layer window but
nothing on the map: this is normal because the file is empty. We are now going to put our
pourpoint in it. In one of the tool bars at the top or the ArcMap window, you will find the
“Editor” button: click on it and “Start Editing”. You might get a window in which you will
have to navigate to the folder in which you are working in, then another windows with the
editable shapefiles will appear: select the one you are interested in (“ex4_pourpoint”) and
“Start editing”. See below:
A: Display the flow accumulation layer to make it easier to locate pixels along the main river.
B: Make sure that the task is set on “create new feature” and the target is your shape file
C: click on the little pencil.
D: select a pixel along the river near the outlet of the catchment that you want to extract.
Click only once. Don’t select a point too close to the confluence: the next step will involve
searching for the pixel with the highest flow accumulation within a search radius and if you
are too close to the confluence, the pixel that will be selected will be downstream of the
confluence and the catchment extracted will be much larger than what you want. When this is
done, go to Editor Stop editing and save the changes. Note: if you want to extract more
than one catchment, you can select more than one pour point.
The next step involves snapping the pour point(s) off the flow accumulation raster: Spatial
Analyst Tools Hydrology Snap Pour Point: use your “ex4_pourpoint” as the input
raster, “ex4_flowacc” as the input accumulation raster, give a name to your output file (e.g.
“ex4_snap”) and specify the search radius in “snap distance”. In your case, the pixels are 5 m
wide: if you specify 10 meters, ArcMap will take your pour point(s), look around in a radius
of 2 pixels and pick the pixel with the largest flow accumulation, that is, the pixel on the main
stem of the river.
The final step is the catchment extraction: Spatial Analyst Tools Hydrology
Watershed. Use “ex4_flowdir” as the input flow direction raster and your “ex4_snap” as the
input pour point raster (leave the optional “pour point” field as it is). Give an output file name
(e.g. “ex4_wshed”) and click ok. Your catchment will appear like this if you have worked
well (see diagram below to the left).
This watershed file is a shape file, you can’t really do anything with it except display it.
You can turn it into a polygon: Conversion Tools From Raster to Polygon. Put
“ex4_wshed” as an input file and create an “ex4_wshedp” file. You can easily edit the
properties of the polygon by clicking on it in the layer window (e.g. just highlight the its
boundaries, see diagram below to the right).
SUMMARY, part I:
1. Set Null ex4_DEM
2. Fill ex4_fill (then remove ex4_DEM)
3. Hillshade ex4_hillshd
4. Flow direction ex4_flowdir
5. Flow accumulation ex4_flowacc
6. Con ex4_strmnet
Stream order ex4_strmorder
Stream to Feature ex4_strmline
7. ArcCatalog ex4_pourpoint (shape file)
ArcMap Editor edit pour point(s) in the shape file.
Snap Pour Point ex4_snap
Conversion from raster to polygon ex4wshedp
II. Extracting the profile(s) with ArcMap
We will extract the profile DOWNSTREAM of a source point. To do so, we need first to
define our source point.
8. Create the source point file.
This involves the same procedure than when we created our pour point (step 7 in part I,
see p. 3):
- open ArcCatalog and create a new shapefile, e.g. “ex4_source” – DON’T FORGET TO
SPECIFY THE COORDINATE SYSTEM.
- Add the file in ArcMap.
- Use the ArcMap Editor to edit your source point in the shape file “ex4_source”: click on
the “Editor” button and “Start Editing”. You might get a window in which you will have
to navigate to the folder in which you are working in, then another windows with the
editable shapefiles will appear: select the one you are interested in (“ex4_source”) and
“Start editing” (see below):
A: your “ex4_source” layer should appear in the layer window.
B: make sure that the task is set on “create new feature” and the target is your shape file
C: click on the little pencil.
D: select a pixel along the river near the top of the catchment downstream of which you want
to extract the river profile. Click only once. When this is done, go to Editor Stop editing
and save the changes.
9. Extract the main trunk channel downstream of the source point.
To extract the channel, we are going to run a cost path. A cost path simply follows a path
of the lowest values in a raster, starting at a given point (our source point). To get the channel
we want to follow a path of maximum flow accumulation down the steepest line of descent.
Go to Spatial Analyst Tools Distance Cost Path.
In the first row, put
your point source file
“ex4_source”. For the
cost distance and cost
backlink rasters, use
the flow accumulation
and flow direction
(see figure to the
right). Then specify
an output name, e.g.
theory, the channel
should appear in your
10. Extract the information along the channel.
For each pixel along the channel, we want the longitude and latitude, river long distance
(= distance that you would travel if you follow the river), elevation and drainage area:
- for the river long distance, we need to run the flow length function: Spatial Analyst Tools
Hydrology Flow Length. Use the “ex4_flowdir” flow direction raster as an input and
generate an “ex4_length” raster. Make sure that direction of measurement is downstream.
- the elevation data is in the raster “ex4_fill” (= the initial DEM with the sinks filled).
- the drainage area is in the flow accumulation raster “ex4_flowacc”: the data it contains are
the number of pixels draining into each pixel. If you want to know the drainage area in
square meters, you just have to multiply the number of pixels by the area of each pixel (in
our case, one pixel is 5*5 = 25 m2).
We use the Sample function: basically, we tell ArcMap “along that line (the channel), we
want you to collect the data (1) elevation, (2) long distance and (3) flow accumulation, to
record it and to store it in a file”. Go to Spatial Analyst Tools Extraction Sample. Add
the following input rasters (from the
scroll down menu): “ex4_fill”,
“ex4_length” and “ex4_flowacc”. Tell
ArcMap that you want to extract data
along your channel: specify
“ex4_channel” as your input location
raster. Finally, give a name to your
output table WITHOUT
FORGETTING TO ADD “.dbf” AT
THE END OF THE FILE NAME (e.g.
“ex4_data.dbf”). You can now open
your table with Excel! Note: you will
find 2 files, “ex4_data.dbf” and
“ex4_data” without extension: open the one without extension with Excel.
11. Last step: reorganizing and displaying the data in Excel.
You will find 6 columns in the Excel file: the first one is not useful, then we have “x”
(longitude), “y” (latitude), “ex1_fill” (elevation in m), “ex4_length” (long distance in m) and
“ex1_flowac” (drainage area in number of nodes). Two things to do before being able to
display the data:
(1) the “Sample” tool runs from NW to SE rather than along your channel, so you will
need to sort all the data by flow length. To do so, select your 6 columns, go to Data Sort
(in the main toolbar) and sort the data by descending “ex4_length”: now the length decreases
monotonously as you move down the table (and in theory, the elevation should decrease as
well whereas flow accumulation increases).
(2) the flow accumulation in column F is in pixels and we want it in m2: in cell G2, do
“=F2*25” where 25 is the area of a pixel, then copy the formula to the rest of the column by
double clicking on the little square at the bottom right corner of G2. Your column G has now
the drainage area of each pixel in m2.
You can now draw your river profile (using columns E and D), show how drainage area
evolves along the profile (using columns E and G), draw a map view of your channel (using
columns C and D – latitude and longitude), etc.
Sharp increases in
drainage area =
Last comment: this method extracts the information along
the channel profile until it reaches the edge of the DEM. If
you want to know where the outlet of your catchment is,
there are different methods of doing that:
- Method 1 (see diagram to the right): put your cursor on
the outlet pixel, record the x and y coordinates at the bottom
right of the ArcMap window and find in the excel table the
row with the closest coordinates. This row is your outlet row
(you might want to highlight/colour this row) you are now
able to know the elevation of the outlet, the drainage area of
the corresponding catchment and the location of the outlet
along the profile (long distance you can locate your outlet on the profile that you have
- Method 2 (see diagram below): use the “identify” button in ArcMap (the “i” in the blue
circle), select the “ex4_length” layer and click on the outlet pixel: this will give you the long
distance value directly and you will be able to identify the outlet row in the table. You can do
that with any layer (flow accumulation would work as well). Do you notice anything
particular on the profile where the outlet is?
YOU HAVE NOTHING TO HAND IN: you can use this data for your essay.
NB: another useful command if you are going to use ArcMap more often: Data management
Raster Clip. This allows you to clip a part of a larger DEM so you can work just on the
part of the landscape that interests you (ArcMap works faster with smaller DEM and the files
generated are smaller).
NB2: if you are just interested in extracting the river profile(s), you can skip steps 6 and 7.
M. Attal, February 2010, acknowledgements to Martin Hurst who produced part II.