Skip to main content

I have over a thousand raster tiles.

I want to create a mosaic of only those tiles that intersect a polygon.

I want the full tiles, so using the polygon as a clipper is not the right solution for me.

Instead, I want to select only those tiles that intersect the polygon (shapefile) and mosaic them into a single image.

Have you tried the following:

 

 

Read the polygon file with the polygon's you want. Send them into a FeatureReader that reads the rasters.

 

Then use the build-in spatial filter in the feature reader to read only the rasters that have the spatial relation "Initiator Intsersects Result".

 

 

This should result in only the rasters that intersect with the Polygon(s) that is/are send in (and the full raster will be read).

You can then mosaic them together.

Hope this works for you :)


@nicholas

Maybe faster if you first use rasterextentcoercer and do a spatialrelation with the polygons.

Then grab the rasters using a featuremerger using the raster ID as key.


When I have a large raster tileset, the first thing I do is create an index file that has at minimum the footprint of the raster and an attribute containing the full or relative path to the file.

 

 

When I need to subset the data the workflow is as follows.

 

 

 

AOI polygon -> FeatureReader (index file, SpatialFilter initiator intersects results, or bounding boxes intersect -> FeatureReader (path to raster file from attribute) - > process subset of images (Mosaic, FileCopy, whatever).

 

 

If the index file is in a format that supports spatial indexing, then it is almost always faster than using a spatialFilter/FeatureReader on the rasters directly.

 

 

When creating the index file, you can also include additional metadata like the resolution, projection, file date, etc.