3

I'm getting the following error - only on one of the vectory layers in my project. Can anyone help? Have tried a restart and reloading the layer and neither worked!

An error has occured while executing Python code:


Traceback (most recent call last):
  File "C:/Users/Claire/.qgis2/python/plugins\EasyCustomLabeling\EasyCustomLabeling.py", line 506, in runLabel
    WKTLine = 'LINESTRING('+ str(geom.centroid().asPoint().x() +0.0001) +' '+  str(geom.centroid().asPoint().y() +0.0001 ) + ' , '+ str(geom.centroid().asPoint().x())+ ' ' +str(geom.centroid().asPoint().y())+ ')'
AttributeError: 'NoneType' object has no attribute 'asPoint'


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


QGIS version:
2.10.1-Pisa Pisa, d20c5b7

Python path: ['C:/PROGRA~1/QGISPI~1/apps/qgis/./python/plugins\\processing', 'C:/PROGRA~1/QGISPI~1/apps/qgis/./python', u'C:/Users/Claire/.qgis2/python', u'C:/Users/Claire/.qgis2/python/plugins', 'C:/PROGRA~1/QGISPI~1/apps/qgis/./python/plugins', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\matplotlib-1.3.1-py2.7-win-amd64.egg', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\nose-1.3.3-py2.7.egg', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\tornado-4.0.1-py2.7-win-amd64.egg', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\backports.ssl_match_hostname-3.4.0.2-py2.7.egg', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\certifi-14.05.14-py2.7.egg', 'C:\\PROGRA~1\\QGISPI~1\\bin\\python27.zip', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\DLLs', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\plat-win', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\lib-tk', 'C:\\PROGRA~1\\QGISPI~1\\bin', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\PIL', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\jinja2-2.7.2-py2.7.egg', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\markupsafe-0.23-py2.7-win-amd64.egg', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\pytz-2012j-py2.7.egg', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\win32', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\Shapely-1.2.18-py2.7-win-amd64.egg', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\six-1.3.0-py2.7.egg', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\xlrd-0.9.2-py2.7.egg', 'C:\\PROGRA~1\\QGISPI~1\\apps\\Python27\\lib\\site-packages\\xlwt-0.7.5-py2.7.egg', u'C:/Users/Claire/.qgis2//python', 'C:\\PROGRA~1\\QGISPI~1\\apps\\qgis\\python\\plugins\\fTools\\tools', 'L:/AC/00018A Northampton Cathedral/GIS']
3

1 Answer 1

1

The Easy Custom Labeling plugin works fine for other layers which have empty attributes, so that is not the issue.

I ran a 'Check Geometry Validity': this came up with nothing.

I then created an 'Area' attribute and populated this, which flagged up that one of the polygons had no area, and therefore no geometry. I deleted this polygon and now it works fine.

So the issue does seem to be NULL geometries. There's probably a quicker way to identify them though.

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.