I had the same unwanted output and after doing some research it seems the cause can vary.
My case was I had some polyline layers with very, very small gaps (in which some fragments were formed by two or less nodes) (Figure 1 and Figure 2).
So, after directly running Lines to polygons
tool, the algorithm would run, but no polygon was created. A warning appeared:
One or more line ignored due to geometry not having a minimum of three vertices.
I discovered the gaps by running Topology Checker
('Must not have dangles' rule) which would result in multiple 'dangling end' errors (Figure 3).
I fixed it with the following steps:
- Converting the lines to points (
Extract vertices
).
- Converting back points to lines (
Points to path
), setting the 'Order field' parameter as 'Vertex index'.
- Converting the lines (paths) to polygons (
Lines to polygons
).
Using QGIS 3.14.1 version.
Figure 1. Polyline in map canvas after loading the layer.
Figure 2. A very, very small gap (zoom+ is at maximum).
Figure 3. Errors appointed by the 'Topology Checker' tool.