Extracting river/canal centerlines is a common task in GIS data processing. Users of ArcMap or ArcGIS Pro likely find it straightforward. Recently, many colleagues have started exploring QGIS, someone in My GIS Group asked about this, making it a good time to document the process.

PS: The author will focus on introducing methods to achieve ArcGIS-equivalent functions in QGIS. If you have specific needs in this area, feel free to leave a comment.

Requirement

The requirement is to extract the centerline from a river polygon shapefile like the one below. The original data was internal. For testing purposes, the author extracted a segment of the Yarlung Tsangpo River data from a previous article: "「GIS Data」China Regional Water System, Rivers, Lakes Dataset". See below:

Method 1

Method 1 comes from @taishou in GIS Group. The steps are as follows:

  1. Convert vector polygons to lines: Vector > Geometry Tools > Polygons to Lines
  2. Edit the resulting closed line (right-click layer → Toggle Editing). Use the "Split Features" tool (Edit → Edit Geometry → Split Features) to split it.
  3. Use the GRASS v.split tool to distribute points evenly along the lines.
  4. Use the GRASS v.voronoi.skeleton tool to generate skeleton lines (centerlines) from polygon features.

Notice there are no screenshots for this method. Why? Because there's a simpler approach. Why keep it then? Because this essentially represents the core algorithm for river centerline extraction. (Take a moment to think about how to implement it.)

Method 2 (Recommended)

After discussing with @taishou, it became clear that the process isn't this cumbersome. You can run step 4 directly from Method 1: the GRASS v.voronoi.skeleton tool can compute the centerline of a polygon directly.

However, the test data in this article consists of two separate lines, requiring some preprocessing. Enter edit mode.

First, select both line segments, then click the "Merge Features" button.

Merge the two lines into a single line. Then run Vector > Geometry Tools > Lines to Polygons.

This converts the line into a polygon. Next, search for "centerline" in the Processing Toolbox and find the GRASS v.voronoi.skeleton tool.

The author ran it without changing parameters (you can explore them). Note: Both the author's and @太守哥's computers froze during execution. Don't close it – give it time. It should eventually complete successfully. The result is shown below:

Method 3

What? A Method 3? Yes, indeed. Found this solution on StackExchange. QGIS truly is flexible!

First, convert the polygon to lines (yes, this method requires line features).

Use QGIS's "Split Features" tool on the closed line. Run the GRASS v.split tool to distribute points evenly along the line. Then run the "Vector > Geometry Processing > Voronoi Polygons" tool on these points. See the image below:

Use "Vector > Geoprocessing > Clip" to clip the resulting Voronoi polygons with the original river polygon (or a line buffered to the river width). Then select only one side (e.g., the left or right half) of the river area – see below – using the Ctrl key with the selection tool.


Clip the selected left or right area from the source layer, as shown in the following image.

Finally, create a line from the clipping result. Zoom in, delete unnecessary parts, retaining only the river centerline.

Does something seem off? The screenshot is in Russian? (Editors note: Original screenshot likely showed a different language UI). That's because the author hasn't personally tried this method – it seems quite complicated. Feel free to experiment if you're interested.

Reference: https://gis.stackexchange.com/questions/318721/creating-centerline-of-river-in-qgis

Conclusion

No lengthy summary needed. Method 2 is the direct recommendation. The algorithm in Method 2 (v.voronoi.skeleton) has parameters that can be tweaked for better efficiency or precision; delve into them as needed. As for Method 3, the author might try it later. Interested readers can also give it a shot to hone their skills.