Bug report #19836

QgsProcessingParameterMultipleLayers unreliable order in processing models

Added by Olivier Dalang over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Processing/Modeller
Affected QGIS version:3.3(master) Regression?:No
Operating System:Windows 10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27660

Description

(note : this looks similar to #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 :

...
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' }
...

Layers from filesystem (always the case when running in batch):

...
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' }
...

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).

tests.zip (10 KB) Olivier Dalang, 2018-09-13 01:03 AM

Associated revisions

Revision ee4afe2d
Added by Julien Cabieces over 5 years ago

Fixes #19836
Keep layer order when using different way for passing layer (layer id or layer pointer for instance)

History

#1 Updated by Jürgen Fischer over 5 years ago

  • Description updated (diff)

#2 Updated by Anonymous over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF