Skip to content
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

QgsProcessingException when loading GMLAS #263

Open
kannes opened this issue Feb 8, 2023 · 1 comment
Open

QgsProcessingException when loading GMLAS #263

kannes opened this issue Feb 8, 2023 · 1 comment
Labels
bug Houston, we've a problem!

Comments

@kannes
Copy link

kannes commented Feb 8, 2023

Environment

  • Plugin version: 1.4.0-beta6
  • QGIS version: 3.28.3
  • GDAL version: 3.4.1
  • Operating System: Ubuntu 22.04

Description

Trying to load a layer from a WFS using the wizard with GMLAS results in an error for me:

_core.QgsProcessingException: Kann Algorithmus nicht ausführen Konnte Quelllayer für INPUT nicht laden: keine Wert für Parameter angegeben 
Traceback (most recent call last):
  File "[...]/python/plugins/gml_application_schema_toolbox/gui/load_wizard.py", line 202, in validatePage
    self._panel.do_load()
  File "[...]/python/plugins/gml_application_schema_toolbox/gui/import_gmlas_panel.py", line 402, in do_load
    self.translate_processing(params)
  File "[...]/python/plugins/gml_application_schema_toolbox/gui/gmlas_panel_mixin.py", line 106, in translate_processing
    res = processing.run("gdal:convertformat", params, feedback=feedback)
  File "/usr/share/qgis/python/plugins/processing/tools/general.py", line 108, in run
    return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
  File "/usr/share/qgis/python/plugins/processing/core/Processing.py", line 181, in runAlgorithm
    raise QgsProcessingException(msg)
_core.QgsProcessingException: Kann Algorithmus nicht ausführen
Konnte Quelllayer für INPUT nicht laden: keine Wert für Parameter angegeben

The german message says that there was no value passed for the parameter INPUT.

The code path confirms that:

params = {
"INPUT_FILE": f"GMLAS:{gml_path}",
"CONVERT_ALL_LAYERS": True,
"OPTIONS": " ".join(options),
"OUTPUT": dest,
}

I already tried changing that to INPUT but then I get another QgsProcessingException about the file path not being found (GMLAS:/tmp/tmpfudmiwrq.gml). I guess the prefix is the issue, the file exists. My GDAL should support GMLAS, ogrinfo GMLAS:/tmp/tmpfudmiwrq.gml lists 25 layers in it.

The QGIS docs for gdal:convertformat do not list a INPUT_FILE parameter so I guess it is simply swallowed in any case?

To Reproduce

Steps to reproduce the behavior:

  1. Have a clean profile, install 1.4.0-beta6
  2. Add a new spatialite database in the QGIS browser, otherwise the plugin will show a warning message bar and crash earlier
  3. Add https://www.gds.hessen.de/wfs2/aaa-suite/cgi-bin/alkis/vereinf/wfs as WFS connection to QGIS
  4. Launch the plugin
  5. "Load (wizard)" -> "WFS" -> "Connect" -> pick "Ave:VerwaltungsEinheit" -> "Load in relational mode (GMLAS)" -> pick the database
  6. After the last step, the described crash will happen

Expected behavior

I guess the data should get loaded as layer?


Additional Context

get_db_format crash

Without an available spatialite database, the plugin would crash with:

AttributeError: 'DatabaseWidget' object has no attribute 'get_db_format' 
Traceback (most recent call last):
  File "[...]/python/plugins/gml_application_schema_toolbox/gui/load_wizard.py", line 202, in validatePage
    self._panel.do_load()
  File "[...]/python/plugins/gml_application_schema_toolbox/gui/import_gmlas_panel.py", line 376, in do_load
    db_format = self.databaseWidget.get_db_format
AttributeError: 'DatabaseWidget' object has no attribute 'get_db_format'

I checked "get_db_format in dir(self.databaseWidget) == True to be true, no idea what's going on there...

Also not working with internal gmlas:convertformat_gmlas algorithm

When I changed the if clause in

to always use the gmlas:convertformat_gmlas algorithm instead, it also crashed saying that the INPUT file could not be found.

Logs

2023-02-08T16:09:26     INFO    Temporary configuration file created '/tmp/gmlasconf_zg052uvi.xml' for conversion.
2023-02-08T16:09:26     INFO    200
2023-02-08T16:09:33     NONE    GDAL OPTIONS: ['-f SQLite', '-oo CONFIG_FILE=/tmp/gmlasconf_zg052uvi.xml', '-oo EXPOSE_METADATA_LAYERS=YES', '-nlt CONVERT_TO_LINEAR', '-dsco SPATIALITE=YES', '-lco SRID=4326', '-forceNullable']
2023-02-08T16:09:33     NONE    gdal:convertformat with params = {'INPUT_FILE': 'GMLAS:/tmp/tmpcimli119.gml', 'CONVERT_ALL_LAYERS': True, 'OPTIONS': '-f SQLite -oo CONFIG_FILE=/tmp/gmlasconf_zg052uvi.xml -oo EXPOSE_METADATA_LAYERS=YES -nlt CONVERT_TO_LINEAR -dsco SPATIALITE=YES -lco SRID=4326 -forceNullable', 'OUTPUT': '/tmp/asd.sqlite'}
@kannes kannes added the bug Houston, we've a problem! label Feb 8, 2023
@kannes
Copy link
Author

kannes commented May 22, 2023

Seems like it was simply not tested and fully implemented on newer QGIS. As a workaround I removed the if clause to always use the internal gmlas:convertformat_gmlas algorithm. In that case one must not tinker with the INPUT_FILE parameter as I did above, INPUT_FILE is correct then, INPUT is not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Houston, we've a problem!
Projects
None yet
Development

No branches or pull requests

1 participant