Howdy!

Trying to debug some issues with the QGIS GML Application Schema Toolbox plugin (https://github.com/BRGM/gml_application_schema_toolbox/issues/263) I realised that I have no idea how to specify a specific driver to be used by GDAL/OGR when running a tool via Processing? Or if it is even possible at all. GDAL/OGR calls them prefixes to the connection string, e.g. https://gdal.org/drivers/vector/gmlas.html#opening-syntax

E. g. this would use whatever driver GDAL/OGR decides to use for the GML file and works:

    processing.run("gdal:convertformat", {'INPUT':'/tmp/tmpssu67zi9.gml','OUTPUT':'/tmp/test.shp'})

But I need to make it use its GMLAS driver. Trying to add the prefix results in a crash because of the file not being found:

    processing.run("gdal:convertformat", {'INPUT':'GMLAS:/tmp/tmpssu67zi9.gml','OUTPUT':'/tmp/test2.shp'})

    Traceback (most recent call last):
      File "/usr/lib/python3.10/code.py", line 90, in runcode
        exec(code, self.locals)
      File "<input>", line 1, in <module>
      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: Unable to execute algorithm
    Could not load source layer for INPUT: GMLAS:/tmp/tmpssu67zi9.gml not found

For this specific tool, the docs say that INPUT shall be "[vector: any]" but passing simple paths works fine in pretty much all processing tools. https://docs.qgis.org/3.28/en/docs/user_manual/processing_algs/gdal/vectorconversion.html?highlight=convertformat

Is there any way to do this?

PS: Crossposted to https://gis.stackexchange.com/questions/451645/how-to-specify-gdal-driver-to-use-for-processing-input

Cheers, Hannes

--
Johannes Kröger / GIS-Entwickler/-Berater

**********************************************
FOSSGIS Konferenz
15.-18. März 2023 in Berlin
https://fossgis-konferenz.de/2023/

WhereGroup-Beiträge auf der FOSSGIS
https://wheregroup.com/unternehmen/aktuelles/
**********************************************

WhereGroup GmbH
Grevenweg 89
20537 Hamburg
Germany

Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11

johannes.kroe...@wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------------------------

_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to