nens / threedi-schematisation-editor

QGIS tool for editing schematisations
0 stars 0 forks source link

KeyError related to impervious surface #134

Closed leendertvanwolfswinkel closed 1 year ago

leendertvanwolfswinkel commented 1 year ago

How to reproduce:

Load from spatialite, choose the sqlite in this zip file: vossenburchkade.zip

KeyError: 1 
Traceback (most recent call last):
  File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\From the developers desk/python/plugins\threedi_schematisation_editor\__init__.py", line 182, in load_from_spatialite
    converter.import_all_model_data()
  File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\From the developers desk/python/plugins\threedi_schematisation_editor\conversion.py", line 512, in import_all_model_data
    self.add_surface_map_geometries()
  File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\From the developers desk/python/plugins\threedi_schematisation_editor\conversion.py", line 296, in add_surface_map_geometries
    isurface_centroid_geom = impervious_surface_points[surface_id]
KeyError: 1
ldebek commented 1 year ago

@leendertvanwolfswinkel Yourimpervious_surface table have mixed geometry type values (POLYGON, MULTIPOLYGON and NULL), which result commit errors during conversion to the geopackage. Is this a valid input data and should be supported or this case should be recognized as an invalid?

leendertvanwolfswinkel commented 1 year ago

@ldebek MULTIPOLYGON geometries should not be considered valid input. Geometries should be either NULL or POLYGON. Please handle this by giving the default 'imported n of m features' message that we also give in other cases; i'll have a geometry type check added to the schematisation checker

ldebek commented 1 year ago

@leendertvanwolfswinkel I did some additional checks and MULTIPOLYGON geometries are actual single part geometries, so their types can be safely converted into single polygons during import process.