I have a vector layer with several polyline segments that represent borders of different areas. Each segment is connected to at least two other segments (at its start and its end). Some segments are connected to more then two other segments.
I need to convert those multiple polylines to multiple polygons. (See fig.)
When I use polygonize tool in vector->geometry menu it treats each segment as it's own polygon and makes garbage. (See fig 2)
Merging all segments into a single one doesn't help. Clipping large polygon with lines also doesn't help in this case since line segments doesn't cross the whole large polygon.
This problem seems obvious but I'm stuck. I can do it in GRASS with ease, but I have no idea how to do it in QGIS. I don't mind using Python scripting for this.
Best Answer
Using QGIS processing: v.clean [snap]
Polyline test![enter image description here](https://i.stack.imgur.com/Xwuqs.jpg)
The threshold is determined by attempts:![enter image description here](https://i.stack.imgur.com/eSGoH.jpg)
final results![enter image description here](https://i.stack.imgur.com/b5lMq.jpg)
To get the polygons: polygonize
polygons![enter image description here](https://i.stack.imgur.com/6tycW.jpg)