16

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

Example_1

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.

Example_2

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

3 Answers 3

19

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 ...

4
  • 1
    This is a great solution. Have you been able to automate this in Python?
    – Aaron
    Commented Dec 5, 2019 at 18:01
  • 1
    @Aaron, Unfortunately, I haven't studied Python yet, but I'm closer to Postgres/PostGIS :-)... Commented Dec 5, 2019 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... Commented Jan 3, 2020 at 20:18
  • gis.stackexchange.com/a/347625/120129... Commented May 7, 2020 at 14:49
6

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.

5
  • Can you provide a link to that plugin, and perhaps mention the version(s) it works with?
    – PolyGeo
    Commented Jan 24, 2020 at 22:49
  • Just tested with QGIS 3.14 (Windows 7)--takes a little time on a complex network, but works well.
    – user25976
    Commented Sep 16, 2020 at 2:32
  • Works really nice in v3.20. (use case: a single, linear polygon with moderately irregular boundary geometry)
    – CreekGeek
    Commented Jul 12, 2021 at 20:19
  • I'll add that this only adresses part of the answer...trimming of the skeleton is still required (per Step 4 on in gis.stackexchange.com/a/318733/17482)
    – CreekGeek
    Commented Jul 12, 2021 at 20:26
  • Be aware that there is a feature limit (100). Commented Sep 8, 2022 at 13:50
3

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
  • 2
    Can you explain how to use it in QGIS?
    – MrXsquared
    Commented Apr 14, 2019 at 14:21
  • 2
    @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
    Commented Apr 14, 2019 at 14:45

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