Remove the value-error for case when a boundary exists with an empty geometry
I ran Greece locally and I got the error: Boundary 1391 does not exist in the database.
This is an empty existing boundary in the Boundaries
table.
- Now, if we look in the
exposureinitializer.py
, in the line 219, there is a value error raise:
boundary_geometry = self.exposure_db.get_boundary_geometry(boundary_id)`
if boundary_geometry is None:
raise ValueError(f"Boundary {boundary_id} does not exist in the database.")
- Looking into the
exposure-lib
, in the line 535 we have:
if result is not None:
return result[0]
else:
return None
So in case a boundary exists, but the geometry is empty,in the exposure-lib
, the get inside the if statement. and then inside the exposure-initalizer
, the boundary_geometry
from the boundary_geometry = self.exposure_db.get_boundary_geometry(boundary_id)
is a None! and the value error is then raised!
We should catch this case precisely or just print a warning instead.
Edited by Laurens Oostwegel