From e2eb0ecbb01453527377b5d6cd42145eb2855c7f Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Thu, 29 Feb 2024 18:37:53 +0100 Subject: [PATCH] HOTFIX * fixes bug where rectangular geometry results in an error during geometry complexity calculation --- konova/models/geometry.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/konova/models/geometry.py b/konova/models/geometry.py index 254ace44..09d81af4 100644 --- a/konova/models/geometry.py +++ b/konova/models/geometry.py @@ -364,7 +364,13 @@ class Geometry(BaseResource): geom_envelope = self.geom.envelope diff = geom_envelope - self.geom - complexity_factor = 1 - self.geom.area / diff.area + + if diff.area == 0: + ratio = 1 + else: + ratio = self.geom.area / diff.area + + complexity_factor = 1 - ratio return complexity_factor