3

I am processing atmospheric data and I need to convert my raster input into polygons so I can find the intersection values between my pixels and other polygon features. I used the Raster Pixels to Polygons algorithm as a part of my process. Each input file has multiple bands representing different time periods.

I have built a model that successfully processes my files, but I have to manually select the bands and change the output name each time. Is there a way to automatically iterate through the bands present in my raster-turned polygon input and adjust the output name for each iteration?

2
  • If my answer worked: What should I do when someone answers my question?
    – BERA
    Apr 26 at 5:17
  • I'm still learning how to use the model designer. Your answer has helped, but it brought up a few more questions that I'm still working through. Parts of your answer are making more sense as I figure things out. I will mark it answered or add some follow-up questions here shortly.
    – steglitz
    Apr 28 at 19:36

1 Answer 1

3

You can execute the model in Batch mode.

I've created a model with:

  1. A number parameter (for the band number)
  2. Raster layer parameter
  3. Vector layer parameter

enter image description here

Run - Run as batch process. Add rows for each band, using Fill down or calculate by expression.

Calculate the output parameter with Calculate by Expression, using the band parameter as input. Replace @number_parameter with the name of your parameter, and the gpkg path and table name

format('ogr:dbname=/home/bera/Desktop/gistest/test.gpkg table=output_band_%1 (geom)', @number_parameter)

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.