nens / threedi-schematisation-editor

QGIS tool for editing schematisations
0 stars 0 forks source link

Exporting YZ profiles to sqlite #91

Closed leendertvanwolfswinkel closed 1 year ago

leendertvanwolfswinkel commented 1 year ago

Example: Table respresentation is:

Y | Z 0 | 3.0 3.4 | 0.2 8.4 | 0 11.5 | 3.1

The content of the GPKG field cross_section_table should be: "0, 5.3\n3.4, 2.5\n8.4, 2.3\n11.5, 5.4"

Which should be written to the spatialite as follows (Y to width and Z to height): v2_cross_section_definition.width = "0 3.4 8.4 11.5" v2_cross_section_definition.height = "3.0 0.2 0 3.1"

leendertvanwolfswinkel commented 1 year ago

labelled as bug because since we moved to schema version 214, this will probably give errors if users use this type of profile

leendertvanwolfswinkel commented 1 year ago

If I try to Load from spatialite this file: https://app.zenhub.com/files/481141268/2a4441ab-89cd-4c62-9f93-25dc3daa5ed0/download, I get the following error. It might be caused by some erroneous contents of the spatialite, created with the 3Di Schematisation Editor version before the latest bugfix.

AttributeError: 'QVariant' object has no attribute 'split' 
Traceback (most recent call last):
  File "C:\Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\profiles\3Di MI testing/python/plugins\threedi_schematisation_editor\__init__.py", line 176, in load_from_spatialite
    converter.import_all_model_data()
  File "C:\Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\profiles\3Di MI testing/python/plugins\threedi_schematisation_editor\conversion.py", line 514, in import_all_model_data
    self.import_cross_section_definition_data()
  File "C:\Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\profiles\3Di MI testing/python/plugins\threedi_schematisation_editor\conversion.py", line 411, in import_cross_section_definition_data
    table_zipp = zip(src_xs_def_height.split(), src_xs_def_width.split())
AttributeError: 'QVariant' object has no attribute 'split'
ldebek commented 1 year ago

@leendertvanwolfswinkel Indeed cross-section data in spatialite was missing for some rows. Regardless that - I've added handling of such cases.