Bug report #19836
Updated by Jürgen Fischer about 6 years ago
(note : this looks similar to #19835 https://issues.qgis.org/issues/19835 but is not related)
The order of layers with QgsProcessingParameterMultipleLayers is not reliable in processing models.
Depending on whether layers are loaded from the project (in normal model execution) or from the filesystem (optional in normal execution, but always the case in batch execution), the order of layers inside a processing model won't be the same.
**Example**
Normal :
<pre>
...
Running Merge vector layers [2/2]
Input Parameters:
{ CRS: None, LAYERS: ['C:/Users/Olivier/Desktop/tests/b.shp','Polygon?crs=EPSG:4326&field=FID:long(11)&field=a:string(1)&uid={c60acafa-8abd-435a-bde6-32416ebeb7ea}'], OUTPUT: 'C:/Users/Olivier/Desktop/tests/results.shp' }
...
</pre>
Layers from filesystem (always the case when running in batch):
<pre>
...
Running Merge vector layers [2/2]
Input Parameters:
{ CRS: None, LAYERS: ['Polygon?crs=EPSG:4326&field=FID:long(11)&field=a:string(1)&uid={886826c9-fa96-43c0-984a-95c9afa585fb}','C:/Users/Olivier/Desktop/tests/b.shp'], OUTPUT: 'C:/Users/Olivier/Desktop/tests/results.shp' }
...
</pre>
**Steps to reproduce**
- Open attached project
- Run the embedded `test` model normally (assign layer a to parameter a and b to b)
- Run the embedded `test` model as batch (again assigning layer a to parameter a and b to b)
- Compare the two results : the merge didn't happen in the same order (look at columns order).
The order of layers with QgsProcessingParameterMultipleLayers is not reliable in processing models.
Depending on whether layers are loaded from the project (in normal model execution) or from the filesystem (optional in normal execution, but always the case in batch execution), the order of layers inside a processing model won't be the same.
**Example**
Normal :
<pre>
...
Running Merge vector layers [2/2]
Input Parameters:
{ CRS: None, LAYERS: ['C:/Users/Olivier/Desktop/tests/b.shp','Polygon?crs=EPSG:4326&field=FID:long(11)&field=a:string(1)&uid={c60acafa-8abd-435a-bde6-32416ebeb7ea}'], OUTPUT: 'C:/Users/Olivier/Desktop/tests/results.shp' }
...
</pre>
Layers from filesystem (always the case when running in batch):
<pre>
...
Running Merge vector layers [2/2]
Input Parameters:
{ CRS: None, LAYERS: ['Polygon?crs=EPSG:4326&field=FID:long(11)&field=a:string(1)&uid={886826c9-fa96-43c0-984a-95c9afa585fb}','C:/Users/Olivier/Desktop/tests/b.shp'], OUTPUT: 'C:/Users/Olivier/Desktop/tests/results.shp' }
...
</pre>
**Steps to reproduce**
- Open attached project
- Run the embedded `test` model normally (assign layer a to parameter a and b to b)
- Run the embedded `test` model as batch (again assigning layer a to parameter a and b to b)
- Compare the two results : the merge didn't happen in the same order (look at columns order).