My goal:
Convert a raster layer representing a river feature (see picture) to the center line of the river stored as a polyline feature.
Limitation:
- The whole process has to be automated.
- I can only use GRASS GIS for this application.
The initial input is a raster resulting from a scanner. From this scan I have reclassified the river.
I have tried the following so far:
- Convert to polygon --> convert to line (out-lines e.g. river banks) --> convert river banks to point --> apply voronoi diagrams and clip this output to the extent of your river --> see output. I tried using v.clean to clean the output e.g. remove dangles but this has not worked yet.
- r.grow to thin my raster or r.thin to thin it --> convert thinned raster to a line --> v.clean to clean the result. This result (black lines) contains "loops" which I did not manage to delete.
Especially here "v.generalize" with a high threshold yielded some better results but still not all loops are deleted. So, you can consider this tool as well in a possible solution!
Any recommendations on a different approach or to alter my previous attempts? In an other post here (Finding the Center Line from a set of 3D Points) they mention a possible interesting approach suggested by Joseph.
EDIT: 28.05.2019 Will work on this tomorrow again and test again my approach which is also mentioned by Micha. Jons' solution seems to be the most robust approach however with my skill and time budget I am not sure if I can reproduce a algorithm which will work in GRASS GIS.