-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2024-10-30-fix-loosing-coordinates-interlis-import #484
2024-10-30-fix-loosing-coordinates-interlis-import #484
Conversation
Should solve #475 |
for more information, see https://pre-commit.ci
… is ok Call with 'Nan' does not work yet
…ttps://github.com/teksi/wastewater into 2024-10-30-fix-loosing-coordinates-interlis-import
for more information, see https://pre-commit.ci
Conversion with 'Nan' not yet as expected - result is None
|
|
@ponceta Any idea how to adapt that? error: cannot format plugin/teksi_wastewater/interlis/interlis_model_mapping/interlis_importer_to_intermediate_schema.py: Cannot parse: 434:91: geom = self.session_tww.scalar(ST_Force3D(coteattribute, COALESCE (NULL,'NaN'))::numeric) |
# situation3d_geometry=self.session_tww.scalar(ST_Force3D(row.lage, row.kote)), | ||
#geom = self.session_tww.scalar(ST_Force3D(coteattribute, "Nan")) | ||
# (COALESCE (NULL,'NaN'))::numeric) | ||
geom = self.session_tww.scalar(ST_Force3D(coteattribute, COALESCE (NULL,'NaN'))::numeric) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geom = self.session_tww.scalar(ST_Force3D(coteattribute, COALESCE (NULL,'NaN'))::numeric) | |
geom = self.session_tww.scalar(ST_Force3D(coteattribute)) |
This is python geoalchemy stuff, the proposed syntax is for postgis pgsql syntax. They are similar but not identical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this still creates this:
2024-10-31T08:56:44 teksi_wastewater.utils: debug: controling situation3d_geometry : 01010000a008080000000000009330444100000000a96331410000000000d49d40.
2024-10-31T08:56:44 teksi_wastewater.utils: debug: controling situation3d_geometry : 01010000a008080000000000808130444100000000a96331410000000000d49d40.
2024-10-31T08:56:44 teksi_wastewater.utils: debug: controling situation3d_geometry : 01010000a008080000000000007030444100000000956331410000000000d09d40.
2024-10-31T08:56:44 teksi_wastewater.utils: debug: controling situation3d_geometry : 01010000a00808000000000000e03344410000000068723141cdcccccccc32a140.
2024-10-31T08:56:44 teksi_wastewater.utils: debug: controling situation3d_geometry : 01010000a0080800005eba49ccde334441d122dbf981723141000000000034a140.
2024-10-31T08:56:44 teksi_wastewater.utils:No reach_point.cote (Haltungpunkt.Kote) provided for object ch080qwzHP01325A- situation3d_geometry z-value set to "Nan" instead: None.
2024-10-31T08:56:44 teksi_wastewater.utils:No reach_point.cote (Haltungpunkt.Kote) provided for object ch080qwzHP01325E- situation3d_geometry z-value set to "Nan" instead: None.
2024-10-31T08:56:44 teksi_wastewater.utils:No reach_point.cote (Haltungpunkt.Kote) provided for object ch080qwzHP01326A- situation3d_geometry z-value set to "Nan" instead: None.
2024-10-31T08:56:44 teksi_wastewater.utils:No reach_point.cote (Haltungpunkt.Kote) provided for object ch080qwzHP01326E- situation3d_geometry z-value set to "Nan" instead: None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if I provider 'NULL' I get a crash:
geom = self.session_tww.scalar(ST_Force3D(coteattribute), 'NULL')
Ein Fehler trat bei der Ausführung von Python-Code auf:
sqlalchemy.exc.ArgumentError: mapping or list expected for parameters
Traceback (most recent call last):
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\teksi_wastewater_plugin.py", line 650, in actionImportClicked
self.interlisImporterExporter.action_import()
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\interlis\gui\interlis_importer_exporter_gui.py", line 87, in action_import
raise exception
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\interlis\gui\interlis_importer_exporter_gui.py", line 68, in action_import
self.interlis_importer_exporter.interlis_import(
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\interlis\interlis_importer_exporter.py", line 152, in interlis_import
raise exception
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\interlis\interlis_importer_exporter.py", line 106, in interlis_import
tww_session = self._import_from_intermediate_schema(import_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\interlis\interlis_importer_exporter.py", line 265, in _import_from_intermediate_schema
interlisImporterToIntermediateSchema.tww_import(skip_closing_tww_session=True)
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_importer_to_intermediate_schema.py", line 41, in tww_import
raise exception
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_importer_to_intermediate_schema.py", line 33, in tww_import
self._tww_import(skip_closing_tww_session)
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_importer_to_intermediate_schema.py", line 66, in _tww_import
self._import_sia405_abwasser()
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_importer_to_intermediate_schema.py", line 120, in _import_sia405_abwasser
self._import_haltungspunkt()
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_importer_to_intermediate_schema.py", line 1971, in _import_haltungspunkt
situation3d_geometry=self.geometry3D_convert(row.lage, row.kote, row.t_ili_tid),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\tww_pre_202403/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_importer_to_intermediate_schema.py", line 435, in geometry3D_convert
geom = self.session_tww.scalar(ST_Force3D(coteattribute), 'NULL')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Stefan\AppData\Roaming\Python\Python312\site-packages\sqlalchemy\orm\session.py", line 2410, in scalar
return self._execute_internal(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Stefan\AppData\Roaming\Python\Python312\site-packages\sqlalchemy\orm\session.py", line 2242, in _execute_internal
return conn.scalar(
^^^^^^^^^^^^
File "C:\Users\Stefan\AppData\Roaming\Python\Python312\site-packages\sqlalchemy\engine\base.py", line 1301, in scalar
distilled_parameters = _distill_params_20(parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "lib\sqlalchemy\cyextension\util.pyx", line 37, in sqlalchemy.cyextension.util._distill_params_20
sqlalchemy.exc.ArgumentError: mapping or list expected for parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ponceta Does this look ok with the geometries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2024-10-31T09:14:30 teksi_wastewater.utils:No reach_point.cote (Haltungpunkt.Kote) provided for object ch080qwzHP01353E- situation3d_geometry z-value set to "Nan" instead: 01010000a008080000e17a14ae912d44410c022b872e8c31410000000000000000.
2024-10-31T09:14:30 teksi_wastewater.utils:No reach_point.cote (Haltungpunkt.Kote) provided for object ch080qwzHP01354A- situation3d_geometry z-value set to "Nan" instead: 01010000a008080000e17a14ae912d44410c022b872e8c31410000000000000000.
2024-10-31T09:14:30 teksi_wastewater.utils:No reach_point.cote (Haltungpunkt.Kote) provided for object ch080qwzHP01354E- situation3d_geometry z-value set to "Nan" instead: 01010000a0080800004e6210f8b32d44416f1283e04e8c31410000000000000000.
2024-10-31T09:14:30 teksi_wastewater.utils: debug: controling situation3d_geometry : 01010000a008080000000000007030444100000000956331410000000000d09d40.
2024-10-31T09:14:30 teksi_wastewater.utils: debug: controling situation3d_geometry : 01010000a00808000000000000c12f4441cdcccc4c4c6231410000000000c09d40.
We do now not 'Nan' but just leave it away. How should the debug message look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
2024-10-31T09:14:30 teksi_wastewater.utils:No reach_point.cote (Haltungpunkt.Kote) provided for object ch080qwzHP01353E- situation3d_geometry with no z-value: 01010000a008080000e17a14ae912d44410c022b872e8c31410000000000000000.
Do we need also treat the case when there is a level but no geometry? What should we do then? |
…ewater_node also, rename coteattribute to levelattribute
for more information, see https://pre-commit.ci
So technically it is already supported, but we should encourage the user to fix geometries otherwise he will face issues when using TWW (network, ...). |
Thank you @sjib for providing this! |
Logger Messages for all 4 cases, example cover:
|
When I import cases with no coordinates I get this network following error again: #476 |
Danke @tomep for this testing:
Ich habe die angepassten Files ausgetauscht und 2 Erfolgreiche Imports machen können 😊
Das funktioniert also, da freue ich mich aber. Super Sache.
Ich sehe nun auch wieder alle SAA-Objekte und die Netzverfolgung kann ausgeführt werden.
|
@sjib are we ready to integrate this? Please undraft and merge if ready! |
Should I change some of the messages to logger.debug?
|
for more information, see https://pre-commit.ci
I leave as is - logger levels seem reasonable to me. |
Add function geometry3D_convert