Solved

Loop 210 rasters and create one mosaic for every 10 rasters

  • 24 February 2021
  • 2 replies
  • 3 views

Badge +4

I have 210 rasters, I am trying to create one mosaic for every 10 of them. The titles will be something like:

  • raster_0_10
  • raster_10_20
  • raster_20_30

I created a custom transformer to loop the rasters. There are two variable called "from" and "to". I increase them with 10 for the failed data. Whatever I do, either it keeps updating the first raster or it fails.

I attached the workbench, unfourtunately I am not able to give a sample data but I provided the CSV file of the namings.

Thanks,

Caner

 

icon

Best answer by lauraatsafe 24 February 2021, 19:43

View original

2 replies

Badge +6

Hi @canerakin​ ,

I'm thinking it might be possible to manage this without adding a Loop to the workspace by leveraging the Group By parameter within the RasterMosaicker. For that, you could use the Grouper transformer to create groups of 10 from your inputs. This will add an attribute called _group_index. Then, you could use that _group_index as the attribute to Group By in the RasterMosaicker to create one raster from each set of 10 input files. From looking at your workspace, I think you could add the Grouper after the Sorter, then the FeatureReader, then the RasterMosaicker for this. Since the groups will already be ordered you could also make use of the Group By Mode: 'Process When Group Changes' for a performance boost.

Badge +4

Hi @lauraatsafe​ ,

You are absolutely right. I don't know why I made it too complex... Thanks a lot!

Reply