Complete Updated Workflow Stream and Catchment Delineation in QGIS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello this is hans von cross senior lecturer at iit delft institute for water education this video will demonstrate how to derive a catchment and its streams from an srtm digital elevation model the procedure in this video we'll use the new pc raster tools plugin so make sure you have it installed in the correct way you'll really start from scratch so we need some orientation we can use the quick map services plugin which can be installed from the plugins menu search for quick map services and install the plugin click close the plugin is installed in the web menu but here you see that the list of options is quite short but if you go to settings you can go to the tab more services and click get contributed pack which will install many more web map services here you see the complete list we're going to use the osm open topo map because we need some topographical information to make an estimate of where approximately our catchment is located we're going to derive the ruler catchment which has an outlet near vermont but we need to look at the river systems on the map and the mountains to see where approximately the area is and to zoom to that area once we've determined the approximate study area we can create a polygon layer from the extent in the processing toolbox search for the tool create layer from extend there you can use the drop-down menu to use the map canvas extent however the coordinates here are in the coordinate system of the background map and we need to use the coordinate system of our project which in this case is utm zone 32 north wgs 84. so i change the projection of the project to 32632 cpsg code and then i can use the map canvas extend and now it uses the correct coordinates i save the file to bounding box make it to shapefile i run it and there it is with the default color let's style it to make it a nice boundary line so i use outline simple line a little bit black line there to indicate the boundary of our study area the next step is to download the srtm tiles you can do that from usgs earth explorer but there's also a nice plugin it's called the srtm downloader plugin install the plugin from the plugins manager click close after installation and it has added this icon here to the toolbar click on the icon and click on set canvas extend it will now use the boundary coordinates of your map canvas you can click the download button at some point it will ask for your credentials to log in to the portal where the data is downloaded from use the link to create a new account or if you already have an account type here the credentials you can also save the credentials then it starts downloading if it's interrupted you just click download again like here it says connection close just click download again and it will proceed this doesn't work on your computer then you can use the usgs earth explorer web interface to download the tiles so it has downloaded four images and click close if i zoom out i see it covers a much larger area than our extent that we have determined for our study because we can't work with all these separate tiles we're going to mosaic them and the easiest way is to make a virtual roster so go to raster miscellaneous build virtual roster and we choose there are the four tiles we keep the default settings here as they are and we save it to a new file this will be a very small file which does not really copy the whole data but just provides a virtual link to the data and it's very efficient because we don't want to continue with this whole data set all the time and here we see it i can remove the separate tiles and i drag the bounding box to the top let's change a bit the style of the bounding box so it's clear with the grayscale background make it red and you see that our study area is much smaller than this mosaic of the dm tile so we need to clip and reproject and the easiest way to do that in one step is to click right on the mosaic and then choose export save as and there choose a file name go a dm clipped and i can choose the bounding box as the coordinates but i first need to change the projection to the one of the project otherwise they'll be led to longitude coordinates let's do that again now we have to correct coordinates i'm going to change the horizontal and vertical resolution to 30 meters and i use as a no data value and out of range value which is minus 9999 which is often used i click ok and it's performing the clip and reprojection and i can remove the mosaic and there is the result now let's quickly style this dm it's a continuous ruster so we use the single band pseudo color renderer there we can use a drop down to select a new color ramp and we are going to use the catalog cpt city which has a lot of nice presets then we go to topography and we can simply choose elevation or any other one here that we like then we need to click classify to apply the colors to the pixels in our dem then there's a nice trick to add the hill shade to the dm colors by using blending so we're going to duplicate the dm layer and it's good practice to rename the layer called hill shape and let's make that one active and here i use the hillshade renderer which on the fly renders the pixel values to hill hillshades when i zoom in it gets a bit blocky so i change the resampling to be linear for zoomed in and cubic to zoomed out and now i can use the blending mode on the dm clipped layer and i use multiply and this gives a nice effect with adding the hill shades to the colors of the dem to further process the dm for catchment delineation we need to install the pc raster tools plugin there are alternative ways using grass or saga there are also videos on my youtube channel about that but the pc raster tools provide a robust way of deriving the catchment and streams pc roster has a gdl supported format but we need to convert our dm first to the pc raster format so therefore we choose the tool convert to pc raster format and it's important to choose the correct data type which is scalar scalar is used for continuous rasters and pc raster is strict on the data types and will always check that when you perform the tools so now we have to dem in pc raster format the next step in the workflow is to fill the syncs and to derive the flow direction this roster does this in one step using the ldd create tool you can find in all these tools a link to the documentation which describes how it works and what the different arguments are that you can give to the tool here you see the different arguments and their descriptions and it will result in a flow direction map with the directions encoded with these numbers and these numbers correspond with the numeric path on your keyboard the different settings of filling are illustrated with this figure and you can find some examples on the bottom of the page we use the dem of pc raster as an input and we keep all the defaults to fill to the maximum possible therefore we use that those large numbers choose flow direction as an output and i run the tool which can take a while this is the most intensive calculation that you do in this procedure so be patient and just wait until it finishes we can close the dialog after processing and now we can have a look at the result the flow direction is a discrete raster with values for the flow directions that correspond with our numeric path so to have a look at it i use the pelleted unique values renderer and to see the unique values in the raster i click classify here we see the different numbers colors they don't really make sense so we need to style this in a better way and for flow direction we need to use a directional ramp and because the pc raster values are not very organized in a linear way i'm going to convert the values with a lookup table to the ones used for saga so in our case value 1 is the south west and in saga that is value five because saga starts at zero for north one for northeast two for east etc well pc roster uses again the numerical pad of your keyboard special value there is a 5 for pc raster which means flat and in saga that is 255 so this will be our lookup table which converts the pc raster directions to the saga directions make sure you change the range boundaries to be exactly the minimum and maximum and for the output format we can use byte because it's 8 bits which can store values from 0 to 255 which will be sufficient let me save it to floatier.diff after processing close the dialog and then we can start the styling go to the layer styling panel switch to paletted unique values click classify and here we see the numbers 0 to 7 and 255 corresponding with the saga flow direction values we remove the 255 because we're going to create a ramp for the other numbers based on the spectral color ram so we choose the spectral one and we can click on the ramp and say edit color ramp and there we can modify those stops first we're going to make the first color the same as the second one by picking the color then we change south to yellow which is r 2 5 5 g 2 5 5 and b 0. then for east we make r0 g255 and b0 to make it green and then for west we use magenta and create it by using a combination of 214 60 and 170. now if you want to do it uh very correct you also need to change the last stop which will be the northwest to a color that is somewhere in between the magenta and the blue so somewhere between the southwest and the north and click ok when you're done and then the color ramp is applied so here we have a directional color ramp the problem is that we still need to add 255 if we click the plus it adds 8 but 8 doesn't exist in the data set so we need to type 255 for value then we can type the names of the labels to make it human readable so each of the value numbers corresponds with the flow direction that we need to type as a label 255 is flat and therefore we also give it a white color by changing rgb to 255 255 255 and we type here flat and there's the result which we also see in the legend in the layers panel we can use blending with the hill shade by putting the hill shade below and changing the blending mode to multiply for the flow direction and when we zoom in we can see then some patterns if you go to the hills and we can interpret these colors and we can use a little bit of smoothing by changing the resampling settings there so that's the result of the flow direction map there are other ways to style the flow direction map using arrows which is explained in another video the next step is to derive our streams therefore we need the strala orders you can also use as an alternative to flow accumulation using aquiflux but here we use the stream order tool from pc raster to calculate the strala orders as an input we use the pc raster flow direction so not the one used for styling and we save this as a stroller and then we run the tool and it results in this nice map with for every pixel astral order and we can style this and the larger the number the bigger the stream so we can use palette unique values because it's an ordinal skill and use their blues as a color ramp and i click classify you get this nice effect where the darker blue the pixel gets the bigger the river is in reality not all pixels belong to a river so we now need to do some calibration to determine uh which strala order threshold should be used to consider pixel as being part of a river and we can do that by calculating boolean maps which travel order larger or equal than a certain value and compare that with openstreetmap or with a satellite image from google satellite for example and then the threshold that matches best with what we see on the map or on the satellite image is then the value that we use for selecting the rivers from the strata or the map so we can do that by using the raster calculator and i double click on stroller use the larger than or equal button and i start with a value of 5 and then i save the result as trial and 5 the output will be diff files in this case click ok and there we see the result and i use the styling from the palleted unique values remove the zeros keep the ones i can make it blue to correspond with the color of rivers and i need to remove some of the layers below i'm gonna hide all keep the strander five and here i'll use openstreetmap as a background and then i compare the result and i can already see that there are far too many streams when i use order five so too many tributaries so you repeat this for different values i'll now skip a few values and go to 8. go with stroller 8. i can copy the style to save a bit of time and i uncheck stroller 5 to see the difference we see now that many tributaries have been removed and this one looks like it corresponds quite okay with the rivers on the map the amount of tributaries that's what we control with the threshold and it is a calibration of a model so you will never get it perfect but try to find the best result here so now we can use that threshold value that we determined for further analysis to derive the streams so i go here to the spatial tool the spatial tool simply creates a raster with the data type based on a value so all the pixels will get that value in that data type and i use here a value 8 on an ordinal scale and i use stroller as a clone and i call this ordinal 8 and there's the result all pixels have value 8. that is because the pc raster tools use mostly maps as inputs so i can now use one of the conditional boolean operators here the comparison operator and then i say if the input raster which is strala is larger or equal to ordinal eight then give me boolean true otherwise give me boolean false so those will be our channels this will tell us boolean 2 for channels and boolean false for where there are no channels let's paste the style here again and it will end up with the same map when we have stroller 8. but now i want to have the strala orders for the river so i need to use if then so the boolean condition is that if there are channels so if channels is true then give me the stroller values else give me no data that's what if then does but if then else you can also control what happens if it's false i run this and now i see that our pixels of the river have the strala orders which i can style with pelleted unique values because it's an ordinal scale and use the blues again and there we see that it has 8 9 10 and 11 as ordered for this area of course it's much nicer to present our channels network as vector lines therefore we need to convert the raster to vector lines and an essential step there is to use the r.pin tool from grass to make sure that the raster lines are only 1 pixel wide and not as in this case multiple pixels there's an input i use channel stroller i keep the maximum number of iterations and i save the output to a geotiff i call it channels finn make sure you change it to jupiter and then i save the result run it and there we see the results and we can now compare channels thin with channel stroller and we see the difference that it has only one pixel width now but we also see that we can suspect some other geometrical problems later when you convert it to vector which we'll do now so i use r to effect from graphs use channel thin as an input line feature type i check the box use raster values as categories instead of unique sequence that make sure that it uses the pixel values and not give unique numbers choose to line and i save the file and call it channels i click run and when it's done close the dialog and there we see the result it's not perfect there are some geometrical issues like overshoots and dangling nodes but overall this is something we can now proceed with there are procedures to correct this but that's out of the scope of this tutorial let's have a look at the attribute table of our channels vector layer that we just created click right open attribute table and there we see that the cut field contains the original roster strala order values but we need to change that into a real strata order so i add a new field order with length 1 and i'm going to write here an equation to convert them i use the case when the end function and i write here when cut equals eight then give value one so all values eight will turn into strala order one when it's nine make its trial order two 10 will be 3 and 11 the maximum in our case will be strala order 4. then i need to close this with the end statement here and when i click ok now we see that those orders have been applied so those are the real strata orders from the method because the raster ordering system gives every pixel strala order but in reality only the streams get an order then i can use the graduated renderer for the vector styling i use the order field and i use the size method and change the size from 0.3 to 1. change it to equal count and then we need to change the legend to discrete strala order numbers you can also change the precision then you have to type again change the color to something blue and now we see our strala orders nicely styled so the thicker the line the higher the strala order and the bigger the river the newer versions of qgis you can easily use tapered line styles there's another video that explains that there's still an issue that it still looks a bit blocky because of going from raster to vector so there's a way to smooth this a little bit so we can look for a smooth tool here in the processing toolbox and i want to do this uh with in place editing therefore i click that button there in the processing toolbox and i use five iterations here in the tool and the advantage of in place editing is that it will immediately save it in the layer and not in a copy you can inspect if it's okay or not otherwise you choose another iteration value and then when you're okay with it you save the results and the whole line is selected so you need to unselect and here we see that it's now smooth so now we can compare the result with the map so i switched on open topo map you can also use openstreetmap or it will set the light and see how well the smooth line matches with the river system and here in the upstream it does it quite well downstream is a bit more human modified and now let's look for the outlet to do our final step which is deriving the catchment from the outlet so there's the river on the map and here's the mouse and where the rule gets in the mouse we have to choose our outlet and that needs to fit with our model so we need to use the delineated stream so we either use channels thin or channels stroller for that then we click right copy coordinate and use the map coordinates paste the coordinates in notepad and add comma 1 so it's a comma separated file with x y and id number if you have more outlets for which you want to derive the catchments you can add multiple lines to this file and it will with the catchment tool or the subcatchment tool derive all the catchments and subcatchments that you list here so save it to a text file and then i can use the tool to convert this to a map so column file to pc raster map choose outlet.txt that we just created as a mask we use the flow direction and output data type is nominal so when you have multiple points each catchment will have the values the nominal numbers that it finds in the outlet map we choose close now it's below our open topo map so i need to drag it to the top then i can style this always good to check if the result is what you think it is so it only contains one value one nominal value one in this case for the outlet and that's the outlet for which we are going to derive the catchment so going to know which area drains to this point i use the catchment tool for ldd i use the flow direction layer for outlet i use the outlet and i save the result as a catchment dot map i run the tool now i click close zoom to the layer now all the pixels with value 1 belong to outlet 1 so if you have multiple outlets they will have their unique numbers now it's much nicer to present this as a polygon so we can use polygonize from cluster conversion use the catchment layer as an input and then save the output and let's call it work catchment i run it that's the result i open the attribute table because i only want the catchment boundary and you see that there are multiple features here with values 0 and values 1. if i zoom to a 1 i see that there are some geometrical issues there because of going from vector from raster to vector so i'm not interested in those individual pixels but i want to know the whole catchment and here i found it and what i can do here is invert the selection toggle on the editing mode and simply remove everything that is not the catchment by clicking the trash bin and save the result so there's our catchment boundary polygon note that there's a little donut hole in it that's because of one of the mines that has its own little catman inside the catchment the phil sings algorithm didn't solve that part so i can now use a technique called inverted polygon shape burst fill so i change the renderer to inverted polygons and the other symbol layer type to shape burst fill i change the first color to gray so 0 0 0 is black 2 5 5 2 5 5 2 5 5 is white and every combination in between of equal values of rgb results in a gray intensity the second color is white and i'm going to apply opacity of 65 here and you can see the effect on the map canvas in real time to set the distance to 4 and i'm also going to increase the blur strength to 10 and now you can really see the catchment popping out of the map canvas which is a very nice effect if you want to highlight the study area and to shade the areas that are outside i also want a black line so i added a second symbol layer and uh add a black line with a stroke width of 0.46 millimeters i want to apply this or visualize this with the dem and the hill shade i have to rearrange the layers a bit move the channels to the top in fact it's nicer to have the catchment boundary on the top so it shades the rivers that are outside you can also clip that in the tutorials written how to clip it use the hill shape there put it below the dm and there's a nice result the dem with the hill shade highlighted in the study area with the rivers on top of that let's uh clip the rivers we choose channels here as an overlay i choose rule catchment we call to world channels run it and move it to the top and i want to copy the style so i don't have to do that again and there it is but now this looks great and we can use this further for our map design now if we want to store all this data that we created we can package this in a geo package so we use the package layers tool and we select the input layers that we want to package and i'm interested in rule catchment and word channels only and you can see here that the checkbox saves the layer styles also in the geo package that's very useful everybody who uses the geopackage will then have the styled layers with the same styles as we defined here note that we can only store vectors in this way if we want to store a raster we can drag it to uh the geopackage so here in the browser panel we see our geopackage and i'm going to add here the the clips layer the tune tiff and i drag it to rto package when i release it it's imported and there will be a message that the import was successful click ok if i refresh the browser panel i see now that dm is also there it doesn't have the styling so what we need to do for our project is to make sure that the layers refer to the layers in our geo package and not the ones that we have on our hard disk as files so i'm going to copy the style of the dm to the one of the geopackage and remove the original one for the hillshade i can simply recreate that by duplicating the layer renaming it to hillshade and then choosing hillshade renderer so i remove the original hill shape then i add the rule catchment boundary if you hover your mouse over it you can see if it's the shapefile or if it's from the geopackage so here are all our layers from the geopackage at the top i can remove the others now we can also save our project in the geopackage so we have everything together in one file in the geopackage so i choose root data and i save it as voor so now our project and the style data are in the geopackage and can easily be shared with others and we can use this for further processing or adding other data you
Info
Channel: Hans van der Kwast
Views: 2,044
Rating: undefined out of 5
Keywords: GRASS, PCRaster, QGIS, QGISHydro, catchment, hydrology, stream, watershed
Id: C3AMh3sZzJQ
Channel Id: undefined
Length: 36min 42sec (2202 seconds)
Published: Thu Oct 28 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.