Closed caver456 closed 3 years ago
the test code, operating on a map with two polygons a11 and a13 that don't intersect:
a11=sts.getFeatures(title='a11')[0]
a13=sts.getFeatures(title='a13')[0]
sts.expand(a11,a13)
the error message:
Traceback (most recent call last):
File "test.py", line 34, in <module>
sts.expand(a11,a13)
File "C:\Users\caver\Documents\GitHub\sartopo_python\sartopo_python\sartopo_python.py", line 1163, in expand
self.editObject(id=targetShape['id'],geometry={'coordinates':[list(result.exterior.coords)]})
AttributeError: 'MultiPolygon' object has no attribute 'exterior'
There are at least a few different ways to intercept this error. For now, catch it early: if the objects don't intersect, show a message and return false. Apply this to all geom ops.
in this case, the result will be a multipolygon. Rather than die with an error, simple return false, i.e. don't try to modify the original shape.