I've had some success and some problems using the Polygonizer plugin in the past. I'm using Polygonizer 2.1 in QGIS 1.8 on Windows 7. I'm aware there are sometimes problems using Polygonizer in Windows, but I was wondering if any solutions or work-arounds had come up since I researched the issue the last time.

The linear layer I want to convert at present is fairly complex and consists of 18693 lines. When I use the "new method", it reaches 44% completion and just stops. I've had it running for about 3 hours now at 44%. Only rarely do I get an error message. When I use the old method, it is extremely slow, completing about 1% per hour. Last year I was able to run Polygonizer successfully on an older computer with Windows 2000, but that machine has since died! Does anyone have any suggestions?

The rarely appearing error message reads:

An error has occured while executing Python code:

Traceback (most recent call last): File "C:/Users/George/.qgis//python/plugins\Polygonizer\PolygonizerDialog.py", line 103, in threadFinished

msg = QMessageBox.question(self, 'Polygonizer', 'Polygonization finished in %03.2f seconds. \n %d polygons were crested. \n Load created layer?' % ((self.t2 - self.t1), polyCount), QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)

NameError: global name 'polyCount' is not defined

Python version: 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]

QGIS version: 1.8.0-Lisboa Lisboa, 6416f38

  • It might be worth reinstalling the Shapely package (python-shapely) from OSGEO4W setup and trying again. Just a thought. N.
    – nhopton
    Sep 25, 2012 at 11:53
  • I just tried that with no success. Thanks for the idea though! G.
    – blackthorn
    Sep 26, 2012 at 5:58

1 Answer 1


After some more work today, I've realised that my problem is a result of file size issues. What I was doing was clipping a subset of line vectors from a larger dataset and then using Union to combine the clip boundary with the clipped vectors in order to close off dangling lines so that Polygonizer could turn these closed line shapes into polygons. The clipped lines dataset was 1.4MB in size and the clip boundary was a mere 4KB. When combined with Union, the resulting dataset was a whopping 45.5MB!

I then used Merge instead of Union, and the final file size was only 1.4MB as you would expect. Polygonizer on this final, much smaller file worked just fine.

Sorry for the waste of time and electrons on this problem!

Unless anyone can explain why Union would inflate the resulting file size so much?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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