Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

[BUGFIX] Handle errors when retrieving geometry data - master_2 #59

Open
wants to merge 1 commit into
base: master_2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions core/project_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,19 @@ def expressionIterator(self, layer, expression, geometryStorage):
evaluated = unicode(qgsExpression.evaluate(f))
if qgsExpression.hasEvalError():
continue
if f.geometry() is None or f.geometry().centroid() is None:
try:
if f.geometry() is None or f.geometry().centroid() is None:
continue
centroid = f.geometry().centroid().asPoint()
if geometryStorage == 'wkb':
geom = binascii.b2a_hex(f.geometry().asWkb())
elif geometryStorage == 'wkt':
geom = f.geometry().exportToWkt()
else:
geom = f.geometry().boundingBox().asWktPolygon()
yield ( evaluated, centroid.x(), centroid.y(), geom )
except:
continue
centroid = f.geometry().centroid().asPoint()
if geometryStorage == 'wkb':
geom = binascii.b2a_hex(f.geometry().asWkb())
elif geometryStorage == 'wkt':
geom = f.geometry().exportToWkt()
else:
geom = f.geometry().boundingBox().asWktPolygon()
yield ( evaluated, centroid.x(), centroid.y(), geom )

def stop_record(self):
self.stopLoop = True
Expand Down