 Hello, welcome back on my YouTube channel. In this video I'm going to show how to smooth rivers that were derived from the stream and catchment delineation procedure. Because these rivers were derived from rasters, they're not very smooth. I'm going to demonstrate this for the fast-trip catchment, and I'll use a new script to delineate the streams and catchment. After zooming in to the extent of the study area, I can set the projection that I want to use. After scripts, I can find the pcruster user scripts that I've downloaded from the resource sharing repository of pcruster that was accessed with the resource sharing plugin. I take the extent of the study area and I pick a point for which I want to calculate the catchment. Take it here on the bridge, I set the strata threshold here of 6, I keep the default 250 meter snapping tolerance because it needs to snap to the river, and I set here the outputs. I store them in a geopackage called Vestra because this is the Vestra catchment. And if I use the same name for the geopackage, then the layers will end up in the same geopackage. We also save some rasters. Here the DEM, and make sure that you choose the mapfiles.map extension, otherwise it will not work. And here the flow direction map. Then run the script which will start with downloading the DEM. After it's done, close the dialog and check the outputs. Here I move the catchment to the top and also the streams and I zoom to the catchment layer and there we see nicely the boundary. I'm going to hide everything except the streams and overstreak map because I want to make those rivers smoother than they are derived now. Here I can style the river to make it a bit clearer and I go to simple line and I change the symbol layer type from simple line renderer to the interpolated line renderer. Here I can vary the stroke width by using the strahler orders. They go from 6 to 10, in a newer version I will renumber the strahler orders of the river starting from 1. Here I change the size 1.5 and that already looks nice but I need to change the color and I make it blue. I use the same blue as OpenStreetMap but then I cannot compare it so I make it a bit darker. So here you can clearly see the blocky artifacts in the river. Now there's an easy way to smooth this on the fly using the geometry generator. So I switch the symbol layer type to geometry generator. It keeps our interpolated line renderer but I can add functions here. So in the expression dialog I use the smooth function. And the smooth function has some arguments, first of course the geometry, then the number of smoothing iterations to apply, the larger number results in smoother but more complex geometries. Then there's the offset, a value between 0 and 0.5 which controls how tightly the smoother geometry will follow the original geometry. If it's smaller it will be closer to the original result and if I make it larger it will be lose. Then I can give a minimum length and that is the minimum length to which the smoothing should apply and a maximum angle to avoid sharp angles. So I'm just going to play with these numbers. I'll start with this and here we see what happens. This looks a bit too straightened. So we need to modify some of the values. The nice thing about the layer styling panel is that you will see live the results. So I modify the length now to 50 and that looks already much better. Let's see what happens if I change some of the other values, put it on 0, the offset and then it is very rough. Now it gets smoother when I increase the number and also with the amount of iterations it gets smoother if I increase the number. So that already looks much nicer than the original result. But this looks very nice, but the problem is that the geometry generator does this on the fly and we would often like to have this also in a file. So there's some good news. There's a nice tool called geometry by expression and with that tool you can use the same expression to store a copy. So I change here the output geometry type to line and I go to the expression editor and here I can also see my recently used expressions except the ones that we tweaked in the layer styling panel. But I can here type the same expression that we found and then I can save the result and when I run it, it generates a new layer and then I need to adjust the styling and use interpolated line renderer. Now I don't need a geometry generator, but the settings are the same for the interpolated line and we also change the color to blue and now we can compare the two results and they are very similar, the slight differences because on the fly I guess overall it looks much nicer than the original line with the blocky artifacts. So in this video you've learned how to smooth rivers derived from the stream and catch the delineation process. You've learned about geometry generators and how to save the result also in a file.