Skip to main content

Hello everyone,

 

I have this very large raster and a shapefile with polygons. My process is a looping one where the raster is clipped with each polygon. In order to avoid reading the whole raster everytime, I've created a subprocess that uses the polygon bounds directly in the search envelop of reader. Then, it is clipped.

subprocess for large raster readingMy problem arise when the polygon used for clipping is outside the raster extent. The "inside" port of the transformer is empty but the process continues. This output is supposed to be used later on in a script (arcpy custom transformer) to align many other rasters. But clearly all this fails because there is no raster.

 

The best solution I have come up with would be to add a Tester or something after the transformer and create a bolean value which would allow me to deal with this empty raster directly in the script. However, I can't seem to find a way to do that.

example empty portMind me, I cannot use the "outside" port since I always have an extra part to cut off because of the reading bounds. I really need to be able to plug the tester on the "inside" port and be able to run it empty or not.

 

Does anyone have an idea? Thanks to this community!

If you use a SpatialFilter before the Clipper with Raster as Filter and Polygons as Candidates (Filter intersects Candidate) you get the outside polygons on the Failed port and you can use them in your next processing step (arcpy script). The output from Passed port should go to the Clipper.


Hi @amdubois​ , the NoFeaturesTester transformer from FME Hub could be what you are looking for.


@Takashi Iijima​ 

Yeah actually I have just been suggested a similar way, the FeatureDetector from the hub. I think it should do the trick.


I took a look at this question during my weekly Question-of-the-Week stream. Actually, I looked at whether you need to loop data or not. In FME 2022, I don't think you need to do that. The Clipper transformer will clip all of the data you want, even if the Clippers overlap, so there's no need to loop or read the raster multiple times.

 

The video is here: https://www.youtube.com/watch?v=oPkjLqq0hzI&t=1548s

 

It's a bit rambling, but you should get the gist of the solution while watching it.


Reply