8. Delineate Streams

8.4. Convert Raster to Vector Lines

For better visualisation of the channel network, we need to convert the channelsstrahler layer to a line vector.

We'll use the GRASS tools from the Processing Toolbox for this.

First we need to thin the raster lines, so they are only 1 pixel wide.

1. From the Processing Toolbox choose GRASS | Raser (r.*) | r.thin

2. In the r.thin dialogue choose channelsstrahler as Input raster layer to thin. Keep the defaults and save the Thinned raster as channelsthin.tif.

3. Click Run to perform the thinning and click Close when the processing is completed.

4. Compare the result with the channelsstrahler layer to understand what r.thin does.

Now we can convert the channelsthin layer to a line vector.

5. In the Processing Toolbox go to GRASS | Raster (r.*) | r.to.vect

6. In the r.to.vect dialogue

  • choose channelsthin as Input raster layer
  • choose line from the drop down menu as Feature type
  • check the box to Use raster values as categories instead of a unique sequence
  • under Advanced Parameters change the v.out.ogr output type to line
  • name the Vectorized output channels.shp


7. Keep the rest as default. Click Run to perform the conversion. Click Close when the processing is done.

The result has some geometrical errors that can be fixed using v.clean from the Processing Toolbox or the Topology Checker plugin. This is not covered in this tutorial.

In the next section we'll style the channels layer.