I made two river bank lines and I want to associate them.


I want to make a centerline using two rows as a base. I managed to make the centre line with a lot of work creating several lines from one margin to the other of the river and then using the centroid, but this solution is very tiring and I have to do this in several areas.


  • 1
    I think after 6 years a new question is legit and answers provided are not up to date for version 3 – MrXsquared Apr 16 '19 at 20:49
  • Yeah, but this question als is 5 years old. – Erik Apr 17 '19 at 8:40
  • @Erik it was asked 3 days ago (2019-04-14) – MrXsquared Apr 17 '19 at 13:50
  • Yeah, I thought April 14 = April 2014 -.- – Erik Apr 17 '19 at 15:18

The surest method for solving your question from the point of view of the cartographic approach is to use the Voronoi Polygons.

I offer one of the solutions to your question using QGIS tools.

So, the initial data is a river as an areal object, see the figure below. enter image description here

2) Vector > Geometry processing > Convert polygons into lines, see image below enter image description here

3) Open the closed line QGIS "Split Features" tool and run the GRASS v.split tool, so that the points are evenly distributed along the line and run the Vector> Geometry Processing> Voronoi Polygons tool on them, see the figure below

enter image description here

or run the plugin with the name in the screenshot below, which is more convenient ... enter image description here

4) Cut the original Voronoi polygons from the result with Vector > Geoprocessing > Trim and then select only one half of the river area, see the picture below using the Ctrl key and the selection tool enter image description here more Vector > Geoprocessing > Merge by grounds ... > By all indications.

enter image description here

enter image description here

5) Cut from the source layer the result of the selected left or the right area, see the picture below.

enter image description here

6) Then from the result of cutting create a line, blow it up, remove unnecessary parts and leave the centre line of the river, see figure below enter image description here

This is the main approach to solving your question and it is clear that a variety of tools allows you to solve your question in various ways, but the idea remains the same, good luck ...

  • This is a great solution. Have you been able to automate this in Python? – Aaron Dec 5 '19 at 18:01
  • 1
    @Aaron, Unfortunately, I haven't studied Python yet, but I'm closer to Postgres/PostGIS :-)... – Cyril Mikhalchenko Dec 5 '19 at 18:30
  • 1
    @Aaron, I implemented this technique in geoSQL (as I call PostGIS) and its result is different from the ST_StraightSkeleton and ST_ApproximateMedialAxis functions... – Cyril Mikhalchenko Jan 3 '20 at 20:18

The HCMGIS plugin says it does this:

Spatial Processing: Create Skeleton/Medial Axis/ Centerline for road/ river networks and similar linear structures

Compatible with QGIS 3 and later; not compatible with QGIS 2.

  • Can you provide a link to that plugin, and perhaps mention the version(s) it works with? – PolyGeo Jan 24 '20 at 22:49
  • Just tested with QGIS 3.14 (Windows 7)--takes a little time on a complex network, but works well. – user25976 Sep 16 '20 at 2:32

Try the GRASS algorithm v.centerline. You may have to tweak around with the parameters, but as long as your river polygons are longer than they are wide it should work for a large portion of your inputs.

  • 2
    Can you explain how to use it in QGIS? – MrXsquared Apr 14 '19 at 14:21
  • 1
    @MrXsquared I am actually now surprised to find that this tool is not accessible from the Geoprocessing toolbox, so I guess my answer is not that appropriate to the question. – wfgeo Apr 14 '19 at 14:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.