I tried to use tool of QGis, Line to Polygon but it does'nt work.

I tested with close lines in the same direction and I tested with intersection of 4 lines but the result is the same, that's generate an empty Shapefile.

I tested with Saga GIS tool in toolbox but the result is the same.

I've the version 2.14.4 of QGis and this is the link for my file : https://we.tl/l8zPIY8V4S


Probably some very minute geometric error but you can resolve this by:

  1. Run the Dissolve tool and enable the Dissolve all option (although it doesn't matter much as the layer only contains a single field).

  2. Run the Lines to polygons tool on the output:


Tested on QGIS 2.16.1-Nødebo.

  • 1
    It's perfect ! But it's so curious that's no work before. And if lines intersect other lines this technic don't work. – Geo-x Oct 10 '16 at 13:25
  • @Geo-x - Glad it worked! I haven't really examined the shapefile but as long as the lines create a closed 'network', you should be able to create polygons from those. – Joseph Oct 10 '16 at 13:28
  • I think in fact, Shapefile have a problem but I don't know what. The Shapefile of this example is very simple. – Geo-x Oct 10 '16 at 13:31

The Polygonize algorithm from the processing toolbox creates the desired polygon with one step.

It can even work with intersecting lines:

enter image description here

You may have to check the geometry validity before, and make sure that common points really share the same coordinates.

  • I didn't know this hide scripts ! Thank you very much. Do you know why this scripts are not in Toobox ? – Geo-x Oct 10 '16 at 13:55
  • Did you still use the Simple Interface? This has been removed by now. Make sure you have processing as a core plugin, and not from the Python plugin manager. – AndreJ Oct 10 '16 at 14:18
  • I can add the .py script with Toolbox in part whose name Scripts > Tools > Add a script from file and after I've to go to search this script. – Geo-x Oct 10 '16 at 15:26
  • For me, the script was in the toolbox from the start. Not sure what goes wrong on your side. – AndreJ Oct 10 '16 at 18:27
  • In an other french forum a user tell me since QGis 2.16 polygonize doesn't appear. I'm on version 2.14.4 and I don't have this script by default. If I add and launch it, a window appear and close after 1 second without results... – Geo-x Oct 11 '16 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.