Skip to main content
Solved

Loop 210 rasters and create one mosaic for every 10 rasters

  • February 24, 2021
  • 2 replies
  • 16 views

canerakin
Contributor
Forum|alt.badge.img+5

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

 

Best answer by laurawatsafe

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.

View original
Did this help you find an answer to your question?

2 replies

laurawatsafe
Safer
Forum|alt.badge.img+11
  • Safer
  • Best Answer
  • February 24, 2021

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.


canerakin
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • February 24, 2021

Hi @lauraatsafe​ ,

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings