[QGIS-Developer] How to convert multiple "in memory" layers parameters to an actual list of files ?
Nyall Dawson
nyall.dawson at gmail.com
Tue Mar 10 16:00:51 PDT 2020
On Wed, 11 Mar 2020 at 02:27, Jean-Charles Quillet
<jeancharles.quillet at gmail.com> wrote:
>
> Hello,
>
> I'm working on a processing plugin. My input parameters are:
>
> one point layer
> a non empty list of line layers
>
> I've found that some of the layers are stored in memory and are not actual files. It happens when a layer is created by QGIS plugins. But for my algorithm I need actual files because the work is done by an external process.
>
> I've been reading through the GDAL and Grass plugins which have the same architecture as mine (launch an external process to do the work). And the function parameterAsCompatibleSourceLayerPath is called to convert an in memory layer to an actual file. I've used successfully this behavior for the point layer and it's working perfectly fine.
>
> However, I cannot find any example of doing the same on a QgsProcessingParameterMultipleLayers, the parameters for my line layers. And the function parameterAsCompatibleSourceLayerPath takes the name of the parameter and returns only one string, so it doesn't seem to work on QgsProcessingParameterMultipleLayers.
>
> What would be the right way to convert a potentially "in memory" QgsProcessingParameterMultipleLayers to an actual list of files ?
Unfortunately - an API call to to this automatically just doesn't
exist in current QGIS versions. If you're keen to dig into QGIS core
development I can give some pointers on how this should be added...
Nyall
More information about the QGIS-Developer
mailing list