I would like to write a Python script in QGIS and would like to use functions from a plugin. For example, QuickOSM plugin has an import function and an "Open" button, that creates a temporary file in QGIS with the result of importing the osm file. I would like my script to perform the same for more files within a folder. I would also like the script to add a new field in the resulting file with the name of the file. How can I do that?
1 Answer
You may use the available QGIS processing algorithms included in QuickOSM plugin e.g https://github.com/ThomasG77/QuickOSM/blob/update-processing-docs/doc/readme.md (Done a PR but not merged at the moment)
You may look at https://docs.qgis.org/testing/en/docs/user_manual/processing/console.html#calling-algorithms-from-the-python-console to understand how to call the algorithms from PyQGIS
By combining both resources, you should be able to achieve what you asked for. The part about adding a new field can be managed separately from calling the Quick OSM processing algorithms.