I have a layer with railway lines, downloaded from OpenStreetMap. Every single track is represented separately, so at trainstations, you have several parallel lines, as well as sidelines that lead to depots. Sometimes, lines are broken (it's OSM!). I want to reduce all these lines to one single, simple line.
An idea is to create buffers around the railway lines and to dissolve them to a single polygon (and maybe apply a negative buffer to reduce its width and generalize the geometry)?
If I could create a medial axis from this polygon,, it would represent quite well the simplified railway line I want to create. However, how to create such a medial axis in QGIS? There is a solutionin in PostGIS: https://postgis.net/docs/ST_ApproximateMedialAxis.html
But unfortunately, I have no experience with postgis, so I'm looking for a solution inside QGIS. A possible solution seems to be the HCMGIS-plugin that has a function "Create Skeleton/Medial Axis". The result represents quite well the railway-track (see screenshot, red line), but with one major problem: it creates a skeleton with small side-lines connecting to the vertices of the simplified buffer.
Second problem: algorith takes quite long for a larger selection - I was able to test it only with a small selection as the calculation for the whole railway-network did not stop even after half an hour. I'm not sure if it works well for the whole network (see screenshot 3 with the red part representing the selection used for testing).
Any idea for alternative solutions?
@Cyril's suggestion of using the midline of the skeltonize method would be perfect for me, but unfortunately, the resulting layer consists of only one object - so the short lines are not separated from the long one.
Maybe there is also a completely different method for solving my problem?