More

How can I extract a smooth river network with QGIS & GRASS?


I'm working with Qgis 2.6.1 and GRASS.

I have used the r.watershed module to create a flow accumulation map. With r.mapcalc I have extracted the river network, then i'm using r.thin to thin out to a single pixel width the lines on the binary raster map.

Then I'm using r.to.vect.line to convert raster to vector lines. Everything looks good however the network doesn't have smooth corners… please look at the picture, my rivers are blue.

Can I change something in this procedure to diminish this effect?


It looks like, from the docs: http://grass.osgeo.org/grass70/manuals/addons/r.to.vect.lines.html that there is a skip parameter. The default is 10 so perhaps if you reduce it you will get more points.

It looks like there's a smoothing function in grass too: http://grass.osgeo.org/grass64/manuals/v.generalize.html

with tutorial:

http://grasswiki.osgeo.org/wiki/V.generalize_tutorial

Please post a pic of the resulting vectors if this works! I'd love to see it.


From your comment, above, regarding region settings, you mentioned that the original DEM is 30 meter resolution. In a WGS84 Long/Lat coordinate system, with degrees as units, that should be about 1 arc-sec. But in your second comment you can see that the resolution ("Computational region" in GRASS terms) is about 54 seconds. Your region covers about about 15 degress N-S and E-W, approximately 1600 km. But it is divided into only 960X1066 rows and columns. So each pixel covers about 1600 x 1600 meters, instead of 30 meters as in the original DEM. That's why your stream network looks "zigzagged".

In short, you need to set the region settings in GRASS with something like:

g.region -p res=0.000283

(The res= setting is the decimal equivalent of 1 arc-sec)

or alternatively, just set the computational region to match the original DEM raster:

g.region -p rast=

I should add that for your region of 1600 km x 1600 km, a resolution of 30 meters per pixel will give you a huge number of pixels. It will be about 51,000 rows x 51,000 columns (instead of the 960x1066 above) which means 2,840,000,000 total cells: probably too much to process on a regular computer. So you probably will want to choose a resolution of 100 meters or 250 meters instead of the 30 meters from the original DEM.