Saturday, 8 August 2015

qgis - Trying to use "Difference" tool gives out "'QgsWKBTypes' is not defined" error


I am trying to separate two overlapping vector layers and find out the difference in QGIS 2.18. I have tried finding difference with layers with points and also with buffers. Both of them give following error:


global name 'QgsWKBTypes' is not defined See log for more details

I have searched the web for this but can't seem to find a solution.




Answer



This problem was already fixed in the source code, see the reported issue.


You have mainly 3 solutions:


Mid term solution


According to the road map, QGIS 2.18.1 will be released in 25.11.2016, you'll get the fix with such version. Simply wait 22 days for it, OK?


BUT


This is free software, so you can get the fix instantly!


Short term solutions





  1. Install a nightly build. Check what packages are available for your operating system here.




  2. Edit the file yourself.


    If you're on GNU/Linux, go to /usr/share/qgis/python/plugins/processing/algs/qgis/Difference.py (on Windows it will be C:\Program Files\QGIS 2.18\apps\qgis\python\plugins\processing\algs\qgis\Difference.py), and make sure line 32 looks like this:


    from qgis.core import QGis, QgsFeatureRequest, QgsFeature, QgsGeometry, QgsWKBTypes 

    If you don't want to edit the file, you can just replace it, downloading the fixed file from here (right click on the link and select Save Link As...).


    You will need administrator privileges to either edit or replace the file. After this, restart QGIS.





No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...