[GIS] Can’t transform lines to polygons

geometry-conversionlinepolygonpolygon-creationqgis

I have a similar question to:
How to join lines in QGIS for later using "lines to poly"?

I have a line shapefile that I wish to transform into a polygon shapefile.
After making some cleaning and closing some gaps, the lines have this look:
Original shapefile (lines)

After that I've made "Vector>Geometry Tools>Lines to Polygons" but I've got this:
Transformed shapefile (polygons)

I've made a detection for dangles… and I found a few on the places that seems to have that kind of error. Also… the location of those points, seems to be on the places the "lines to poly" process fails.
I've tried to edit some of the dangles, snapping them to the nearest point to make sure there were no gaps… but running again the dangles detection, they're still there.
This is how all the shapefiles (plus the dangles) look like:
Shapefiles (lines+polygons+dangle detection

Is this easy to fix without "going to the grass"?
Why don't the dangles disappeared after snapping them to the correct place?

EDIT 1:
I was able to clean all the dangles… I was not happy with the snapping… and I've retried once more. I guess I was trying the wrong ones… I tried a very simple one… and one by one I was able to solve the more complex dangles, some were overshoot lines that were behind other segments and other were the intersections.
Well… after that, I was able to clean all the dangles!!!! 😀

Now for the bad news… I got an error while making the Lines to Polygons:

An error has occured while executing Python code:

Traceback (most recent call last):
  File "C:\PROGRA~1\QGISCH~1\apps\qgis\python\plugins\fTools\tools\doGeometry.py", line 348, in run
    success = self.lines_to_polygons()
  File "C:\PROGRA~1\QGISCH~1\apps\qgis\python\plugins\fTools\tools\doGeometry.py", line 519, in lines_to_polygons
    if inFeat.geometry().isMultipart():
AttributeError: 'NoneType' object has no attribute 'isMultipart'

Python version:
2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]


QGIS version:
2.4.0-Chugiak Chugiak, 8fdd08a
(...)]

Does this ring any bells to you guys?

(by the way… the first question was about the dangles… now it's about the lines to polygons process, however… the question is "Can't transform lines to polygons" should I close this and start another or may I continue here?)

EDIT 2:
user30184 asked for the Layer (no dangles at the moment):
Lines shapefile

Best Answer

So... I'm answering my own question. I'm just selecting my answer because it's not using GRASS and, at the moment, I'm trying to stick to the QGIS environment (in the future, I'm almost sure I'll need to invest more in GRASS).

So... this is what I've did:

  1. I selected the select attributes by rectangle enter image description here
  2. selected my whole layer enter image description here
  3. Opened the layer attribute table, where I found this: enter image description here
  4. Then turned into edit mode, inverted the selection, deleted those 2 attributes (ID 104 and ID 106), saved and exited edit mode. The table became: enter image description here
  5. After that... just needed to run Poligonize: enter image description here
  6. And... here it is, the final result: enter image description here

Resuming... it was not the "save as" that corrected the layer. It was those 2 attributes (some kind of trash from previous handling of the shapefile) that were corrupting the file logic, after removing them Polygonize was able to run without any kind of trouble.

Related Question