tutorial : how to use qgis for hydrology - · pdf filerevised may 5, 2017 tutorial : how to...

58
Revised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate data that StormShed4G can use for analysis. Although the tutorial is specific to QGIS, the GIS methods are common to all GIS programs, hence any GIS program can be used to create the data files that StormShed4G will rely upon. To follow along, download the tutorial data set from: http://www.engenious.com/downloads/QGISTutorialDataSet.zip To the extent possible, we will use the files in the tutorial data set to demonstrate methods and procedures. Copy the contents of the Data set and place in a folder named QGISTutorial. Your folder structure should look like: ProjectData folder: In the scenario that we are starting from, much of the preliminary engineering has already progressed to the point where there is sufficient agreement about the project to do some storm water analysis. The work was done on CAD. To get those CAD files to GIS, the relevant layers must be saved as shape files. This folder represents shape files that should be brought to the GIS application. Boundary.shp Ex contour.shp Proposed contours.shp Storm pipes.shp Storm struct.shp GIS shape files are not just a single file with the .shp extension. Generally the shape file specification allows for multiple files of the same name but with different extensions. Together the entirety of the group of files are referred to as the shape files. Generally, the shp files created by CAD do not include a .prj file extension. Without the .prj file, the shape file only locates the site and structures using coordinates. The issue is that the coordinates still need to be geo-referenced in order enable the GIS program to locate the site in the correct part of the world. Much of this tutorial attempts to help with that. The ability to geo-reference correctly is a primary source of frustration for novice GIS users. Lidar Files that are tied to quad maps The tutorial example is in Washington State, specifically the Puget sound area. There is a source for LIDAR available from http://pugetsoundlidar.ess.washington.edu/lidardata/index.html. Generally, users will look through this site to get a DEM raster and geo-referenced topo images. For this tutorial, we obtained the following:

Upload: vohanh

Post on 06-Feb-2018

249 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate data that StormShed4G can use for

analysis. Although the tutorial is specific to QGIS, the GIS methods are common to all GIS programs,

hence any GIS program can be used to create the data files that StormShed4G will rely upon. To follow

along, download the tutorial data set from:

http://www.engenious.com/downloads/QGISTutorialDataSet.zip

To the extent possible, we will use the files in the tutorial data set to demonstrate methods and

procedures. Copy the contents of the Data set and place in a folder named QGISTutorial.

Your folder structure should look like:

ProjectData folder: In the scenario that we are starting from, much of the preliminary engineering has already progressed to

the point where there is sufficient agreement about the project to do some storm water analysis. The

work was done on CAD. To get those CAD files to GIS, the relevant layers must be saved as shape files.

This folder represents shape files that should be brought to the GIS application.

• Boundary.shp

• Ex contour.shp

• Proposed contours.shp

• Storm pipes.shp

• Storm struct.shp

GIS shape files are not just a single file with the .shp extension. Generally the shape file specification

allows for multiple files of the same name but with different extensions. Together the entirety of the

group of files are referred to as the shape files.

Generally, the shp files created by CAD do not include a .prj file extension. Without the .prj file, the

shape file only locates the site and structures using coordinates. The issue is that the coordinates still

need to be geo-referenced in order enable the GIS program to locate the site in the correct part of the

world. Much of this tutorial attempts to help with that. The ability to geo-reference correctly is a

primary source of frustration for novice GIS users.

Lidar Files that are tied to quad maps The tutorial example is in Washington State, specifically the Puget sound area. There is a source for

LIDAR available from http://pugetsoundlidar.ess.washington.edu/lidardata/index.html. Generally, users

will look through this site to get a DEM raster and geo-referenced topo images. For this tutorial, we

obtained the following:

Page 2: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• 2000-05pugetlow_project.shp

• 2000-05pugetlow_QQ_indes.shp

• 2000-05pugetlow_tile_index.shp

We will use these to figure out what the correct projection is for the CAD files.

SCS Soils Maps These are available from the Natural Resources Conservation Service (NRCS) the website is:

http://websoilsurvey.sc.egov.usda.gov/App/HomePage.htm

For this project, we downloaded wss_aoi_2015-08-27_10-39-06.zip, it contains the soils related files

used in this example.

TauDem Installation Turns out that there is another installation that is required to use QGIS. Much of the processing of

different DEM layers is done with a plugin named TauDEM (http://hydrology.usu.edu/taudem/taudem5/).

The interesting thing about it is that when you install QGIS, the TauDEM package seems to be included.

But apparently it’s not. You need to go to the above site and install it yourself.

The windows installer for TauDEM is also available from the Engenious Site:

http://www.engenious.com/downloads/taudem/taudem537_setup.exe

To complete all the steps in this Tutorial Please download the following plugins and install in your version of QGIS. They are python plugins

required to get data from the GIS to make available in StormShed4G.

http://www.engenious.com/downloads/QGISPlugins.zip

This zip file contains three folders. Copy the folders to the

C:\Users\YourFolder\.gis2\python\plugins

Folder. So when you are done, the folder structure will look like:

• C:\Users\YourFolder\.gis2\python\plugins\CNSubAreas

• C:\Users\YourFolder\.gis2\python\plugins\LineSlopes

• C:\Users\YourFolder\.gis2\python\plugins\PipeNetworks

If this is a new install of QGIS, some third party plugins might need to be installed. Select

Plugins/Manage and Install Plugins from the QGIS menu. Install the following plugins:

• OpenLayers plugin

• Value Too plugin.

Getting Started Put all your data files under a single directory on your computer, as shown above. Then

Page 3: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Start QGIS Desktop, Select Project/New to create a new GIS project.

• Load a world view to find your project site. Select Web/OpenLayers plugin/Bing Maps/Bing

Road. You could use Google Maps or one of the others as well.

Notice that Bing Road was added to the Layers Panel.

• Zoom into where the tutorial project is located, perhaps to the County level. Zoom into

Washington state, in the vicinity of Tacoma. It should look like:

Page 4: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• In the Browser panel, navigate to the LIDAR maps that were downloaded

Page 5: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

select them, right mouse click (RMC)and select Add SelectedLayers. The shapes should appear

over your project. In this case they cover most of Western Washington (zoom out if necessary to

get the same view).

.

Page 6: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

This is a visual indication that the LIDAR maps are correctly geo-referenced in the world.

• In file explorer, navigate to one of the LIDAR shapes, and look at the file with the .prj extension.

In this example, we will open (I use NotePad++, use any text editor that you prefer) 2000-

05pugetlow_projects.prj. It contains the line:

PROJCS["NAD_1983_HARN_StatePlane_Washington_North_FIPS_4601_Feet",GEOGCS["GCS_

North_American_1983_HARN" ,. . .

The bold text is the projection of the map. Select all three shapes in the Layers Panel, right

mouse click (RMC) and select the properties menu item. Select the General Category and

change the Coordinate reference system to the match the bold text.

Hint: in the filter field type nad 1983 harn stateplane Washington <- Notice that this is the

same as above except I substituted a space for the underline (_). Make sure you select the one

that ends in Feet.

Apply the changes to the Properties control and press OK to close it.

• Now change the project coordinate reference system to the same projection (102748) by

clicking on the in the lower right corner of QGIS Window, it opens the Project Properties

dialog. Make sure the Enable ‘on the fly’ CRS transformation checkbox and select the

projection.

Press the Apply button then the OK button to close the dialog.

Note: So far, we have started the GIS program, displayed a map of the entire world and loaded

LIDAR Index shapes that encompass the location of our project site. Then visually

verified we are looking at the correct part of the world. Then we changed the

Page 7: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

coordinate reference system of those LIDAR shape files to what the .prj said they were

(this step isn’t really necessary, but the point is to re-inforce the idea that shape files are

based on a projection. Sometimes you need to tell the GIS what that projection is).

Then we set the project coordinate system to the same projection, and enabled on-the-

fly projection. Once this is done, when you load another shape file, and the shape file

has a .prj file, QGIS can look at the projection that the shape file is based and transform

it to the project coordinate system automatically. Works most of the time, somethings

not.

• In the Browser Panel (if not visible, it can be found View/panels/BrowserPanel) select all the

CAD Shp files in the ProjectData folder. Right mouse click (RMC)and select Add Selected Layers.

Depending on the state of the project, QGIS will either provide warnings about the CRS or

present a dialog asking for the projection of each layer. Just in case, sequentially select each

layer in the Layers Panel by RMC on it and select Set Layer CRS menu option. Select

EPSG:102748.

Since these are CAD files, they didn’t have a .prj file associated with them, so we need to

explicitly tell QGIS the CRS to use on them. We selected EPSG:102748 because that is the LIDAR

projection.

• Look at where the project CAD files are relative to the Puget sound Index layers, they should be

in the right location, this project is drawn near Ferndale, Washington, which isn’t correct.

Note: It might be hard to find the site. We recommend that you turn off all layers except the

boundary.shp layer (select it), then click on the button to display it, then turn on the

Bing Road layer to see where it is relative to the rest of the world.

• RMC on each of the CAD layers and change the projection (use the Set CRS menu item) to

NAD_StatePlane_Washington_South>FIPS_4602_Feet (EPSG: 102749). Don’t know why, … we

have run into this numerous times.

Zooming into the site, we see it is in the correct location.

Note: We find it strange and cannot explain why just about everything lines up based on

NAD_StatePlane_Washington_North except for engineering drawings in Washington.

More times than not, we have found that they don’t map correctly unless we tell the GIS

program that their projection is NAD_StatePlane_Washington_South.

Page 8: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

We can now turn off a bunch of layers so that QGIS will render faster.

• Let’s insert the soils data. Navigate to the spatial directory of the SCSSoils folder and open

soilmu_a_aoi.shp by RMC on it and Selecting Add Layer. They can all be opened, but generally,

the largest shp file normally contains everything that is needed. It should open directly over

your project. The soils should have a WGS 84 world projection (look at file with same name but

with the .prj extension), since we set the default CRS projection (See lower right of the QGIS

desktop) to EPSG:102478, it should be georeferenced correctly. Move the layer below the

boundary layer to see it.

Page 9: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

To get those colors, open the properties dialog for the soilmu_a_aoi layer and modify the styles.

This is roughly what I did.

• Turn all layers off except for the boundary layer. Then turn on the 2000-05pugetlow_tile_index

layer. Zoom out to see the quadrangle map outlines. Use the properties dialog to add the labels

to it.

Page 10: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

This shows us that the project site is located in q47122b3207.

• From the LIDAR site referenced at the beginning of the tutorial, download the .tif file associate

with that location. (it is also included with the tutorial data set, in the LIDAR folder).

Digital imagery is available from many locations, in Washington State try

http://guides.lib.uw.edu/c.php?g=341497&p=2299097 or from the USGS

http://viewer.nationalmap.gov/launch/

• Go to the Browser Panel and RMC on q47122b32be.tif and Select Add Layer, it’s projection is

EPSG:102748. Set it by RMC on properties and setting its CRS (coordinate reference system).

Look at it and move it below the site CAD layers so that the layers are above the tif.

Note: The reason why it is necessary to manually set the crs for the tif file is because tif’s have

no projection, hence even though the project as a default projection of 102748 and CRS

on the fly transformation is selected, the project doesn’t know how to transform the tif

file.

• We will use this layer later. It should appear either over or under the boundary layer. Move it

below the boundary layer to view appropriately. Hide the layer for now.

Comment: The first part of putting together the project is done, everything lines up correctly.

Unfortunately, there is more work to do to make it useful. It would be a good idea to save the project

now. Save it to the QGISTutorial folder.

Making useful maps The previous section just got all the necessary info lined up, . . . properly geo-referenced. Now we need

to create layers that are useful.

Get the Site Area I’m sure the first thought is that we have the boundary layer from CAD. That works.

• Click on the boundary layer to make it active.

Page 11: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Click on the Attribute table button in the toolbar, or right mouse click (RMC) on boundary and

select Open Attribute Table.

There’s no area, just angles and lengths. The problem is the CAD shp file is a line file, not a

polygon file. The first thing that needs to be done is to create a new shp layer and make it a

polygon layer. Close the Attribute table. The steps are:

• Select Layer/Create Layer/New Shapefile Layer,

• Specify the type as Polygon,

• Set the Coordinate Reference System (CRS) as EPSG:102748, and

• Click OK and give it a name (leave the New field area blank) and save it to the

QGISTutorial folder. We will call ours PolygonSiteBoundary.

• Select Settings/Snapping options

Page 12: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• With the PolygonSiteBoundary active, click on the button to enable editing.

• Click on the to begin adding features.

• Starting at the upper left corner, moving clockwise, snap to each snap point until

finally snapping on the lower left corner. To close the polygon, RMC and enter an id

in the popup window. Enter 1, press OK.

• Finally, click on the again to conclude the editing session. Save the polygon

layer when asked.

Note: Use the Snap to Point feature and snap to all point in the boundary layer. There is a

QGIS feature Vector/Geometry Tools/Lines to Polygons. . . that might work, depends

on how exact the end points of the lines match up.

Open the attribute table for the new PolygonSiteBoundaryLayer. If the area isn’t displayed, add

it by clicking on the field editor button, , Creating a new virtual field, then selecting $area

under Geometry in the middle column. Make the field name Area, change the field type to

Decimal number and change the precision to something relevant, for example 6. Press OK.

about 6 acres. At this point the boundary layer can be

removed from the QGIS project. Note: Your area will differ depending on how you snapped

around the boundary.

Getting areas for sub-basins This is more complicated than one would like. To get drainage areas, we need to know how runoff flows

through the site. We already know where the site is, so all we need to do is super impose a DTM or

DEM over the site. In most cases, engineers have a survey of the site, maybe a little bit outside the site

boundary, probably not the entire watershed. This is where LIDAR comes in.

Looking at Elevations We are now at the point where elevations matter. Elevations/slopes are the basis for the establishment

of drainage areas. The CAD files probably include layers for existing and proposed contours. The simple

solution is to create DEM/DTM models from that. If they are available, then there isn’t a need for LIDAR.

If not, LIDAR data will have to do. This section illustrates how one would use LIDAR generated data.

• Turn off all layers except the PolygonSiteBoundary layer. We no longer need the CAD boundary

shape file.

• Turn on the layer q47122b32be, this was added earlier and hidden, to make it visible.

• Position it below the PolygonSiteBoundary Layer. It is much larger than necessary. Using it at

that size will be very time consuming. What is the correct working area for a DEM raster? The

Page 13: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

answer is whatever is needed. There are very few sites that sit at the apex of a mountain where

everything drains away from the site and nothing drains into it.

Assuming yours is located within a watershed and not at the apex, the working DEM Raster

needs to be large enough to include all areas draining into the site. It also needs to include area

downstream of the site for whatever regulatory condition that is required.

This section will just use the entire quadrant (rather than crop it to a small size to increase speed

and decrease processing time). The assumption is that the entire project is enclosed in this

quadrant (otherwise it will be necessary to merge a couple quadrants together – QGIS has basic

tutorials on how to do this). We will focus on how to manipulate QGIS to arrive at a reasonable

existing drainage area.

Note: We like to know what the elevation is at the mouse location. QGIS has a plugin named Value

Tool that does provides this information.

Using QGIS Hydrology features. Important links are:

• http://hydrology.usu.edu/taudem/taudem5/downloads.html

• http://docs.qgis.org/2.2/en/docs/user_manual/processing/index.html

• http://qgissextante.blogspot.fr/2012/11/some-hydrological-analysis.html

• http://qgissextante.blogspot.co.uk/2013/01/hydrology-analysis-with-taudem.html

Steps to figure out existing drainage paths: • Make the q47122b32be layer visible.

• From the menu, select Processing/Toolbox to expose the toolbox.

• From the menu, select Processing/Options

• Activate TauDEM as shown:

Page 14: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Look for TauDEM in the Processing Toolbox. If it is there, you are in good shape, if it isn't, then

select the advanced interface at the bottom of the toolbox:

Page 15: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

If you get this message:

Page 16: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

There is a problem with the QGIS installation, you will have to physically go to the QGIS folder

location and create a folder named Msys. Even more irritating is that the mouse cursor will

have been changed to a busy cursor. The only way I found to get rid of it is to save the project,

close and reopen QGIS.

• If it still isn't there, skip to the appendix and install it, the section title is Where is the TauDEM

Analysis package?

• From the Processing Toolbox, run Pit Remove in the TauDEM/Basic Grid Analysis Tools

subdirectory:

Page 17: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Leave the Pit Removed Elevation Grid empty, letting the program create a temporary file.

Notice that a new layer was added with a default name of Pit Removed Elevation Grid. When it

is completed RMC on the layer (in Layers Panel) and select Set Layer CRS to EPSG 102748, or

whatever is appropriate for your project coordinate system. When finished, a new layer will

have been added to the Layers Panel.

Note1: If you get a log error message like: global name 'escapeAndJoin' is not defined See log

for more details

Read this link:

https://fossies.org/diffs/QGIS-

final/2_14_9_vs_2_14_10/python/plugins/processing/algs/taudem/TauDEMUtils.py-

diff.html

If you have to make that change, here is what you need to know:

o Python doesn’t like tabs. Use spaces to position the text in the correct column.

o The text in green should be entered exactly as shown, . . . . down to the space!

Sorry about this. This was not a but in early versions of QGIS. It surfaced sometime

between the initial writing of this tutorial and version 2.18.4.

Note2: If you get an error indicating mpiexec could not be found, try the solution here:

https://gis.stackexchange.com/questions/164935/running-taudem-in-qgis

• From the Processing Toolbox, run D8 Flow Directions in the TauDEM/Basic Grid Analysis Tools

subdirectory:

Page 18: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Make sure the Pit Removed Elevation Grid is selected and leave the D8 Flow Direction Grid and

D8 Slope Grid blank. These will be created with default names. This processing takes more than

30 seconds, depending on your machine, it could take longer than 15 minutes. When it is done,

don't forget to Set the Layer CRS (coordinate reference system) again! If you intend to take a

break and step away, make sure your computer setting isn’t going to put the computer to sleep

in 5 minutes! Be sure to set the CRS when it is done. When finished, a new layer will have been

added to the Layers Panel. The GIS layer

will look like this. Don’t abort, even if the dialog says that it unresponsive. While it is running, if

you think it is hung up, look at the cpu activity on your machine.

• From the Processing Toolbox, run D8 Contributing Area in the TauDEM/Basic Grid Analysis

Tools subdirectory.

Make sure D8 Flow Direction Grid is selected, leave all other fields blank again. When finished,

remember to select Set Layer CRS. We like to change the color gradient (properties) to White to

Page 19: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

black (RMC on the layer, select properties, select style). Another layer will be added to the

Layer Panel.

• This step may or may not be necessary, it depend on your site and the resolution of the D8

Contributing Area Grid created in the previous step. Select the Stream Definition By Threshold

command in the TauDEM/Stream Network Analysis Tools subdirectory. The settings should be

as follows for this example:

Note: The Threshold is a number that needs to be experimented with for each project. The

smaller the number the more detail that is provided for the stream definition. For this

example, we settled on a threshold of 40, but actually, the Contributing Area Grid

provided enough detail to meet the objective, which is to estimate the boundary of each

contributing drainage area. If you move the PolygonSiteBoundary layer to the top and

Page 20: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

zoom in, you will see showing the

drainage pattern around the site.

• Turn on the PolygonSiteBoundary layer, move it above the Steam Raster Grid (if you created

one) and the Contributing Area Grid. The Stream Raster Grid looks a lot like the Contributing

Area Grid in the previous step. It is, but with the upper reaches gone. For Large watersheds,

this is handy. For smaller watersheds, not so much, as the Contributing Area Grid shows what is

needed. The image below again changed the style of the layer from “black to white” to “white

to black” (RMC the layer, select properties, select style).

Page 21: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Create a point shape file (menu sequence: Layer/Create Layer/New Shape File Layer) that

contains point where the stream crosses the boundary.

Based on where the site boundary intersects the Stream Raster or Contributing Area Grid, create

and Outlet (just name the shape file Outlet and place it in the QGISTutorial folder). It is just a

point shape file, the point indicating where the site boundary intersects the stream. To save a

step (and it’s easy) place the points right on top of the stream, zoom in on the area if necessary.

Page 22: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

When points are added to the shape file, you will need to provide an id. (To place points on

the layer, make sure the layer is selected, click on , then click on . These id’s

don’t need to be unique, but for the purposes of what you are doing, THEY SHOULD BE

UNIQUE. In this example they are assigned as follows:

When finished creating them (there should be four) it will be positioned relative to the

stream grid, it will look like:

Page 23: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

The Id’s that are assigned to each point will be “matched up” with a basin Id that will be assigned

later. Id 1 will eventually correlate to “B-001”.

• Run Move Outlets To Streams Tool in the Processing Toolbox, TAUDem Steam Network Analysis

folder. This generally isn’t necessary if the point in the above layer are on the stream. In the

following screen capture change the directory from TauDemPractice3 to QGISTutorial

Note: At the time of this writing, this command fails because the command calls the incorrect

executable. Examine the error message:

Aborting: failed to launch '"C:\Program Files\TauDEM\TauDEM5Exe\moveoutletstostrm" -p

The tool is looking for MoveOutletToStrm.exe file. Navigate to the above path.

Inspection of the directory indicates the MoveOutetToStrm.exe file really isn’t there, but

instead there is a Move OutletToStreams.exe. Make a copy and rename it to

MoveOutletToStrm.exe in order for the tool to work.

The above will create a layer named Output outlet Shapefile. If you compare that to the Outlet

layer, they are very close. It’s up to you to decide if it is better to “eyeball” the outlet location or

have this command do it.

• Now that we have the Outlet locations, Repeat several of the above steps to get rid of the

clutter.

Page 24: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Re-compute the Contributing Area Grid, but this time specify the outlet locations. Make sure

you change the dropdowns to reflect the correct layer. It is easy to just accept whatever the

defaults are when the dialog appears, don’t!

Note: After running the Contributing Area Grid tool a second time, notice that there are now

two layers named D8 Contributing Area Grid (we find it interesting that QGIS will allow

this, but that is because both reference different files). Obviously, you are only interested

in the new one. Since we are replacing the old one, it is ok to remove the first D8

Contributing Area Grid before doing this.

Incidentally, if you do this and the location of one of the outlet points is NOT in the middle

of a stream, the contributing area associated with that stream is going to be MISSING.

Page 25: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Create a new shape file called Existing Basins Polygon, then manually draw the polygons to

delineate the subareas for each basin. Incidentally you can turn off all the layers that you don’t

need to speed up the rendering. All that you really need is the outlet, polygonSiteBoundary and

the D8 Contributing Area Grid, the capture below also includes the Stream Raster Grid

Page 26: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

The above drainage areas are created by defining a new shape file of type polygon and manually

drawing the perimeter around the four outlets. We drew the polygon areas based on the Stream

Raster Grid. The above screen capture shows the Screen Capture Grid. Depending on the quality

of data for the project, the Contributing Area Grid could also have been used. Remember to

snap to existing points! With that done, we aren’t finished. The areas above don’t respect the

site property line. Ideally, we want to further divide the areas into areas inside the site and

areas outside the site draining to each outlet.

• Select Vector/Geoprocessing Tools/Intersect…

Page 27: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Again change the TauDemPractice3 folder to the QGISTutorial folder. We end up with:

• Select Vector/Geoprocessing Tools/Symmetrical Difference.

Page 28: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

We end up with:

Page 29: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Using the selection Tool , select the areas (all areas) outside the boundary.

• Select Edit/Copy Features from the menus.

• Hide the ExteriorExistingBasins layer.

• Make InteriorExistingBasins the active layer.

• Click on the pencil to go into edit mode.

• Click on the icon to add Feature.

• Press Control-V to paste the exterior basins into the current active layer.

• Click on the pencil to go into edit mode. to exit the edit mode. The option to save

changes will be presented. Save it.

• Click on the Attribute Table button. Modify it to look like:

Page 30: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

The BasinId’s are based of the id column. The BasinId’s that have “Offsite” attached to them are

the ExteriorBasins that we just created. Obviously, name them whatever you want, but they

need to be text Id’s not numeric, . . . probably around 20-character minimum. These BasinId’s

need to be unique. You should look up the documentation for how to use the attribute table.

Here, you will need to add a Field (or column) named BasinId. You will also need to remove a

Field (id-2), then you will need to add the basin id’s for each row and recompute the areas.

This is what it now looks like (I’ll leave it to you modify the colors, add label and set

transparency).

Page 31: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

At this point, we have subareas that drain into the site and subareas within the site. Now all

that remains is to map the soil types within each area.

Get the soils areas: Turn off all layers except

• PolygonSiteBoundary and

• InteriorExistingBasins (which include all the onsite and offsite drainage areas).

Should look something like this:

• Turn on or add the soils layer, Soilmu_a_aoi

Page 32: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

What we are after is the soil that make up each B-00x and B-00x-Offsite area.

Conceptually, we want to get the intersection of the two areas (the InteriorExistingBasins and

soilmu_a_aoi layers). The problem with the current layer configuration is that the “native”

projection for the soilmu_a_aoi layer is WGS84, and the boundary is EPSG:102748. Believe it or

not, this is the primary reason we decided to provide such a detailed guide on how to use GIS to

get what StormShed needs.

Initially, our intent was to just tell users what StormShed needed and let the user

figure out how to get it from their GIS of choice, but we ran into this problem and

realized that for non-GIS users, the experience could have been prohibitively

frustrating. This problem is one of the primary reasons why these steps are included in

the tutorial. NOT realizing the fact that their projections are different will result in no

results when the intersection is performed!

We need to convert one of them the match the other. Which one? It has to be the soilmu_a_aoi

layer because it is WGS84, which is longitude/latitude, . . . can’t get areas from that.

In QGIS, Select the soimu_a_aoi layer to make it active. Press the Select Features by Radius

button:

Page 33: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Click on the center of the InteriorExistingBasins layer and drag to create a radius until it

encloses all the basins. You should see all the soils areas turn yellow, meaning that they

are selected.

• Select Edit/ Copy Features (or just press control-c).

• Now Select Edit/Paste Features as/New Vector Layer

• Be sure to specify WGS84 as the CRS of the soilmu_a_aoi layer. This is important, QGIS

is asking for the projection of the soilmu_a_aoi layer.

• When asked to save the layer as:

Page 34: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Here, QGIS is asking what projection you want to save the layer as, it will do the

transformation to the project projection, which is EPSG: 102748. Name it

reGeoreferencedSoilsLayer (for this tutorial), save it anywhere you want.

• Now turn off the soilmu_a_aoi layer.

• Make the reGeoreferencedSoilsLayer layer active.

Page 35: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Select

• Now do the intersection

The new layer will show up somewhere on the canvas, it might be below another layer

and not visible. Find it in the Layer view and move it above other layers if necessary.

Hint: I will be created with the name Intersection, RMC on it, select Rename and then

give it a name that is meaningful, . . . like Site Soils.

• Click on the SiteSoils layer to make it active. The reGeoreferencedsoilsLayer isn’t

required anymore.

• Click on the Attribute Table , add the area to the table if it isn’t there.

Page 36: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

In order to save the change click on the button.

• It is ok to remove the reGeoreferencedSoilsLayer layer from the drawing. If only the

layers PolygonSiteBoundary, InteriorExistingBasins, and SiteSoils are visible, it will look

like:

Page 37: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Within each sub-drainage basin, we have the areas for different soils types. The

InteriorExistingBasins shape file is the .shp file StormShed will use to get the Curve

Number (CN) subareas for each basin!

Using the CNSubareas Plugin The last step is to create a comma separated value (csv) file containing this data that can be

imported to StormShed. Before creating the csv file, revisit the Attribute table for the Site

Soils and Update the Areas! The format of the csv file is as follows:

The first row is a header row listing the column headers. Each subsequent row are data

rows. The csv columns are:

id: integer representing the soil polygon before intersection with site boundary

mukey: scs map unit key

basinId: Basin id that Storm will be assigned to StormShed

soilname: Familiar name of soil as defined in the component.txt file provided by the

SCS website

hsg: Hydrologic soils group as defined in the component.txt file. If the

component table list multiple HSG, Stormshed will use the last one, for

Example, if the table lists A/D, Stormshed will use HSG of D and ignore the

A.

Area: Area in square feet.

For QGIS users run the CNSubareas plugin:

Page 38: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

The Icon will probably change by the time this tutorial becomes

available. Use the tool tip to find it.

Note: If the plugins aren’t on your toolbar, select Plugins/Manage And Install Plugins.

Click on the Installed menu, you should see CNSubareas, Line Slopes and

PipeNetworks there. Make sure they are checked. If they aren’t, they will not

be visible.

Fill it out as shown:

Note: Component.txt is a file that is included with the soils data downloaded from

http://websoilsurvey.sc.egov.usda.gov/App/HomePage.htm, wss_aoi_2015-08-

27_10-39-06.zip. It can be found in the \tabular folder. Also, the … button gives

a warning about overwriting the component.txt file. It’s not going to be

overwritten, just read to extract info.

The CNSubareas plugin creates a file in the same directory as the SiteSoils.shp location

named SiteSoils.csv. It is not absolutely required that the csv file contain values for

soilname, hsg or area. They can be manually entered into StormShed. For that matter, all

the data can be manually entered into StormShed!

How do I get the actual soilname associated with the MUKEY in the attribute table? Included with the files obtained from the NRCS (where you got the soilmu_a_aoi layer), is a Microsoft

Access database with the .mdb extension. Open it and look at the component table. It lists the Mapunit

Key (MUKEY), the associated Component Name (which is the soils name as engineers know it), and

Hydrologic Soils Group. What engineers do with these is up to them, in many cases, the local

municipality might specify what CN (curve number) to use for soils in their jurisdiction. With the soils

specific to the area above, simply add a couple of columns to the attribute table, one for soil name and

one for CN.

• Open the attribute table of SiteSoils layer.

• Click on the button to edit the table.

Page 39: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Click on the button to add a column.

• Add a column for Name, and one for CN.

• Once the columns have been added, double click on the fields in the table and enter the

appropriate values, for example:

Discussion: The above procedure demonstrates how one would use the intersection command to get

sub-areas inside a larger area. In this case, it demonstrates how to get the areas of each soil type

associated with the project site, or it could have been the drainage basin. Procedurally, adding the

two additional columns can be done earlier, in the reGeoreferencedSoilsLayer.shp file. Those values

would carry over with the Intersection command, but there are also many more soils the update. In

all likelihood future versions of Stormshed4G will do this automatically. An alternative is to simply

create a column for Name and HSG type, then enter the CN in StormShed4G. To be clear, filling in

the Name and CN columns, is not fully automated. The appropriate values need to be typed into the

Name or CN column for each row. The cvs file does contain the values.

Time of Concentration Getting the time of concentration for a watershed basin can be tricky. There are lots of different ways

to compute time of concentration. Incidentally, we define time of concentration as the longest time it

takes for runoff to accumulate at a downstream point of analysis. Conceptually, it is the time in which

runoff from all points in the upstream basin contributes flow at the point of concentration. The method

that the SCS or TR-55 uses is to divide the runoff path to the point of analysis into sheet, shallow and

channel drainage paths, requiring the lengths and slopes of the runoff segments need to be known.

This section demonstrates how QGIS can be used to derive those segments. Start with these layers

turned on:

It should look like this:

Page 40: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

We will be working with basin B-002.

• Create a new Shapefile Layer:

• Make it a Line Shapefile

Click Ok and Name it TTLayerAsPolyline.

Pick a path that represents what you think is the longest hydraulic path to the point of analysis

of B-002. (In a real project, you would probably have your contours and elevations displayed

Page 41: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

and/or some type of natural drainage course. In this example, just imagine that the lines shown

reflect the drainage course).

This is a single polyline. Conceptually, that’s fine. We recognize that it is representative of the

path to point 2. If we look at the attribute table:

Note: Don’t forget to un-toggle the edit pencil and save the changes.

There is only a single polyline defined, but there isn’t anything that tells us that it is the polyline

from B-002. The next step is to make that correlation. Do it by manually adding a BasinId

column, or use the Vector/Data Management Tools/Join Attributes by Location menu item.

Page 42: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Note: We are joining the InteriorExistingBasins to the TTLayerAsPolyline layer, not the other

way around.

Add the layer to the project and look at its attribute table:

We know that the polyline path consists of multiple segments, each with its own length and

slope. What we really need is those separate segments and slopes.

From the Processing Toolbox, select Explode lines

Page 43: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

It will create a layer named Exploded regardless of whether you save to a file or just accept the

temporary file that is created. In this case, save it to a file location in your project directory, give

it a file name of TTLayerAsSegment. We use that name to create the csv file (you can name it

anything you want as long as you remember it). Click on Layer named Exploded in the Layer

Panel. Hover the mouse over it, the tooltip will give the saved filename. Make it the active

layer.

The next step is to create a csv file that StormShed can import for travel time lengths and slopes.

Page 44: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Reload the Line Slopes plugin, click on and enter:

There should be a new file in the same directory as your project named TTLayerAsSegment.csv

or whatever you named the exploded layer. The TTLayerAsSegment.csv file is used by

StormShed4G to import travel time segments used to compute Time of Concentration for each

basin.

The first line of the TTLayerAsSegment.csv file is the header containing column names: runid,

basinid, segment, length, slope. All subsequent lines represent segments of the polyline.

Discussion: TT reaches are necessary for TR-55 sheet, shallow and channel flow

computations. Alternatively, you could just use average slope for the watershed, and apply one

of the velocity equations available in 4G.

Conveyance Systems In addition to using a GIS to obtain sub-drainage areas and travel time segments for time of

concentration computations, GIS can also be used to describe conveyance systems. Rather than

develop an elaborate fictitious scenario to demonstrate the workflow, we will develop a generic

example devoid of any specific site geometry. We will leave that to you.

The example will use the same raster layer that we have been using and work against one of the shape

files that was provided for this example. As a reminder, the shape files that are provided with the

example were exported from an AutoCAD drawing and not developed from the GIS program. This is

intentional since most engineers develop sites using AutoCAD.

Turn off all layers except the following. If you have followed along the PolygonSiteBoundary should be

present. The storm pipes layer might need to be added to the project.

Page 45: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

It will look like:

Looking at the attributes table for storm pipes, there is a lot of information, but we aren’t going to use

it, instead, we will assume that none of it is present and the goal is to take a shape file from AutoCAD

that represents the layout of a conveyance system, and bring it into StormShed. What the CAD file

contributes is simply the correct coordinates for the network elements.

The first step is to create another shape file based on storm pipes that represents the same layout. This

needs to be done to ensure the ends of each pipe are identical with the beginning of the next pipe.

With GIS this is easy, just create a line shape file and draw lines by snapping to points!

• Create a new layer:

Don’t forget to make it a line and set the CRS!

• Name it StormLinesAsPolylines. Then make it the active layer.

Page 46: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Click on then to begin adding features.

• Select Settings/Snapping Options

• Draw the layout. For this demo, we are only doing the lines in red.

Generally, do long runs first, from upstream to downstream. In this case we started with

128, 101,99,103 for the first run (to the outlet), then connected 129, followed by 130,

followed by 131 before moving on to 125, 94, 93, 92,104, then we did 121, 95, followed by

120, 106, etc. you get the idea. After doing a long run, do the shorter ones up to where

you snap into a previous run. When you are finished, the new layer looks like:

Page 47: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

And the attribute table looks like:

Page 48: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Each row represents a polyline (or pipe run). Polyline consists of one or more segments (or

pipes). The next step is to convert the 11 polyline segments into individual lines (yeah, we

are essentially right back where we started, except this time the beginning and end points

for each pipe segment are at the same point). But, before we do that, lets create a node

layer that represents the beginning and end points for each segment.

• Create a new vector layer and name it StormNodes.

• Using the snap feature place points at the upstream and downstream of each segment.

Make sure you are snapping to the StormLinesAsPolylines layer, number them

consecutively. It will look like this:

Page 49: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

The attribute table looks like:

• Add a column and give each node a unique node id. In this case we will use N-xxx matching

the xxx with then numeric id. Allocate 20 characters for the id. Do whatever makes sense

for your project. It looks like:

Page 50: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Comment: This example starts with an ACAD storm layout, creates a polyline layer

representing the storm layout, then creates a node layer representing the

manhole/node locations. You could reverse the steps and create a layer with the

nodes, then create another layer representing the layout by snapping to the nodes.

You would essentially end up at the same place.

• From the processing Toolbox, select QGIS geoalgorithms/Vector geometry tools/ Explode

lines.

Save the exploded layer to a file named StormLinesAsSegments.shp. Note that the name of

the layer will appear as Exploded, . . . if there is already a layer named Exploded, there will

then be multiple layers with that name. Figure out what it they represent by hovering your

mouse over the name. In this example, we renamed the layer ExplodedStormLines.

Page 51: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Note: Whenever you see the option to save to a temporary file and you don’t elect to save

it to a real file, you will be able to do whatever you want with that layer, just

understand that when you save, exit and the subsequently re-open the project, the

temporary file isn’t restored, so that means whatever you are going to do with it

has to be completed in the current session. In this case, it is important that you

save it to a real file because the name of a csv file will be based on it.

The attribute table for the exploded polyline layer is just a single column named “id”. The

id’s in that column are not unique. Id’s that are duplicates mean the segments came from

the same polyline. Add a text column (allocate 20 characters) named reachid (You can’t

name to column something else, it has to be reachid, lowercase), in this example we will

just label the id’s P-xxx where xxx is a consecutive number. It looks like this:

Page 52: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

Note: If you decide to explode the lines again, you will lose the reach id for each row and

will need to re-type them. For small changes (meaning adding a line with only a

single segment, it is probably better to do it in the exploded layer.

Using the PipeNetworks Plugin The PipeNetworks plugin expects the name of a vector layer, . . . specifically one that contains the

individual pipe or reach lines that comprise a drainage layout and the raster layer from which to derive

the ground surface elevations at each vertex.

• Select

• Run the PipeNetworks plugin

There should be two csv files created. The names are based on the actual file that is

represented by the Exploded layer, StormLinesAsSegments.shp. The file names that are

created, appends “-layout” and “-nodes” to the shp file. In this case, you will find

StormLinesAsSegments-layout.csv and StormLinesAsSegments-nodes.csv.

-nodes.csv The first line in this file is a header line telling the user that there are four columns, nodeid, x, y, and

ground elevation. The remaining lines are those values. The nodeid is the id that you entered into the

attribute table, in this example it has the format: N-00x, but you can name it anything you want,

commas and quotes are not allowed. Please keep it short, preferably less than 20 characters. Having

100 character id’s doesn’t help you quickly find anything.

This file is used to create or update StormShed node records. If it creates a node record, it only sets the

Max El, North and East Coordinates which is essentially the rim elevation of a manhole. Updating a

node just updates the same, Max El, North and East Coordinates.

-layout.csv The first line in this file is the header line telling the user that there are 6 columns, reachid, runid, reach,

length, upNode and dnNode. The remaining lines contain the values.

Page 53: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

lineid: This is a unique id that you entered into the attribute table. In this example, we used the format

P-00x, but it can be anything. Commas and quotes are not allowed. Please keep it short,

preferably less than 20 characters.

runid: This represents a run of pipes/reaches. In this example, when the polylines were drawn, there

were eleven (11) runs.

reach: Within each run we numbered the pipe/reach sequentially.

length: The total length of the reach.

upNode, dnNode: The node id matched against the id listed in the -nodes.csv file.

The -layout.csv file is used to either update or create StormShed reaches. If it updates an existing reach

record, it will only update the up and downstream node id. When it creates a new reach, it defaults to a

12” diameter, concrete pipe (manning = 0.012) that is 100 ft long with zero (0%) slope.

What now? After creating the .csv files, proceed to StormShed4G to see what to do with them. The documentation

for the continuation of the tutorial can be found at:

http://www.engenious.com/StormShed4G/Documentation/GraphicalInterface.html

Appendix How to get Elevations at Nodes From DEM This is fairly straightforward. It is used to get elevations from lines.

• Create a new project.

• Add the raster layer q47122b32be to it.

o Make sure to set the CRS to EPS 102748 as well as the default projection.

• Create a new shapefile layer based on polylines and enter a couple of polylines. It will look like

this:

Page 54: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Select Vector/Geometry Tools/Extract Nodes to get nodes in polylines.

o For Input line or polygon vector layer, select the name of your polyline shape file.

o For output point shapefile, give it something, like NodesInPolyline.

• Open the attribute table for the NodesInPolyline shapefile, and give each Node a unique Id (N-

001, etc);

o Add a column for the nodeid’s and leave the polyline id’s this allows us to identify pipe

runs.

o

Page 55: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Use Point Sampling Tool Plugin to get elevations at each Node:

o When using this tool select all fields that you want to be moved to the new shape file.

o For the output vector layer, give it a name like NodeElevations. When it is created look

at the attribute table, it will contain three columns id, NodeId, and q47122b32b. The Id

column has a identifier that identified the original polyline. q47122b32b is the elevation

at each node.

• Use Processing/QGIS geoalgorithms/Vector geometry tools/Explode lines tool to break

polyline into lines. What you will end up with is not impressive, looking at the attribute table:

o Add three columns to the attribute table, Length, yCoord, yCoord, all decimals widths of

20 and precision of 10.

o For length just select under Geometry, $length

o For xCoord select under Geometry, $xat and enter $xat(0) for the expression.

o For yCoord select under Geometry, $yat and enter $yat(0) for the expression.

o The Attribute Table now looks like:

Page 56: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

• Now we need to add some columns to the NodeElevations Attribute Table.

o Add the same two columns for the NodeElevations Table as the previous. Add

upXCoord and upYCoord. It now looks like:

• Finally, we are going to do a join on the ExplodedPolyline layer. Click on the layer to select it.

Then select the menu Vector/Data Management Tools/Join Attributed by Location.

o The Target Vector layer is the ExplodedPolyline layer.

o Join vector layer is the NodeElevations layer

Page 57: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

o For Attribute Summary, select the Take attributes of the first located feature, this would

be the upstream node location assuming the polyline was drawn upstream to

downstream.

o Give the output shape file a name like CompleteExplodedPolylines

o Probably keep all records.

o When completed, open the attribute table for CompleteExplodedPolylines and add a

column for the length.

o Next add a new column named ReachId, manually enter a unique reach id for each row.

It should look something like this:

Where is the TauDEM Analysis package? It should be located under the Processing menu in QGIS.

• Select the Toolbox menu item. At the bottom of the Processing Toolbox dialog, there is a combo

box that allows selection of Simple or Advanced Interface.

• Select the Advanced Interface, TauDEM should be there.

• If it’s not, try selecting Processing/Options/Providers. If TauDEM is listed as a provider, Activate

It. If it isn’t there, then it probably needs to be installed on the workstation/computer. Visit

Page 58: Tutorial : How to use QGIS for Hydrology - · PDF fileRevised May 5, 2017 Tutorial : How to use QGIS for Hydrology This tutorial looks at the steps and methods required to generate

Revised May 5, 2017

http://hydrology.usu.edu/taudem/taudem5/index.html, download the appropriate installation

package and install it.

• After installing it, return to Processing/Options/Providers and activate it.