Skip to main content
Question

How to filter raster tiles that intersect a polygon feature?


nicholas
Contributor
Forum|alt.badge.img+10

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.

3 replies

jurgen
Contributor
Forum|alt.badge.img+12
  • Contributor
  • June 13, 2019

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


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • June 13, 2019

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


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • June 13, 2019

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.

 

 


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