Solved

How to loop through a file geodatabase for feature classes to be used in a Clipper


Badge +8

I have a reader (file geodatabase) that contains about 900 polygons and want to use each feature independently as a clipper in a Clipper transformer, since I want to clip a few rasters based on that clipper. The result should be connected to that input somehow.

icon

Best answer by takashi 1 May 2018, 05:43

View original

10 replies

Badge

Another way of doing this but with the same result:

 

 

1) Read all your polygons

 

2) Connect to a FeatureReader and read your raster file. Set the spatial filter in the FeatureReader to 'Contains'. This way, only the parts of the raster inside each polygon should be read.

You can add a FeatureReader for each raster you would like to process, or use a 'Directory And File Pathnames Reader' to read the path to all rasters and use this attribute in the FeatureReader.

Badge +8

Hey

As shown here? In this case I don't get a result and I should. in this case with only one polygon.

Userlevel 2
Badge +17

Hi @felipeverdu1, create copies of raster for every polygon (i.e. make groups of raster and polygon having 1:1 relation), then clip the raster by the polygon for each group. This screenshot illustrates my intention.

 

Badge +8

Hi @felipeverdu1, create copies of raster for every polygon (i.e. make groups of raster and polygon having 1:1 relation), then clip the raster by the polygon for each group. This screenshot illustrates my intention.

 

Hi @takashi, this is really great. This works smoothly. Thanks for your answer and help!

 

Badge +8

Hi @felipeverdu1, create copies of raster for every polygon (i.e. make groups of raster and polygon having 1:1 relation), then clip the raster by the polygon for each group. This screenshot illustrates my intention.

 

Hi @takashi,

 

 

I need to send one polygon at a time, I am having some difficulties with that. How do you recommend that I should do it?

 

 

Userlevel 2
Badge +17

Hi @felipeverdu1, create copies of raster for every polygon (i.e. make groups of raster and polygon having 1:1 relation), then clip the raster by the polygon for each group. This screenshot illustrates my intention.

 

What is the criteria to select one from 900 polygons at the run time?

 

 

Badge +8
What is the criteria to select one from 900 polygons at the run time?

 

 

 

Hi

 

I need to do an analysis with the raster files (5 of them) within that polygon, independently since otherwise it would take a lot time to process. The output (for now a vector data) should be named after its respective polygon. I attatch the fme workbench so you can see what I do (in this case for 1 polygon).step1-ta-0105.fmw
Userlevel 2
Badge +17

Hi @felipeverdu1, create copies of raster for every polygon (i.e. make groups of raster and polygon having 1:1 relation), then clip the raster by the polygon for each group. This screenshot illustrates my intention.

 

You are using "fme_feature_type" (feature class name of the source polygon features) as join key in the FeatureJoiner. Since all the input features have the same feature class name, the joining operation in the FeatureJoiner would be equivalent to unconditional CROSS JOIN. i.e. <number of resulting features> = <number of Left features> x <number of Right features>. Naturally it takes a long time. Is it your intended operation?

 

If you are going to merge only features which are sourced by the same original polygon, you should use unique ID of the original polygon features as join key. Possibly "OBJECTID" or "_count" could be used.

 

 

Badge +8
You are using "fme_feature_type" (feature class name of the source polygon features) as join key in the FeatureJoiner. Since all the input features have the same feature class name, the joining operation in the FeatureJoiner would be equivalent to unconditional CROSS JOIN. i.e. <number of resulting features> = <number of Left features> x <number of Right features>. Naturally it takes a long time. Is it your intended operation?

 

If you are going to merge only features which are sourced by the same original polygon, you should use unique ID of the original polygon features as join key. Possibly "OBJECTID" or "_count" could be used.

 

 

Hey,,

 

it was not my intended operation. The reason why I wanted to do it by polygon (10x10km) it is that the RasterBanCalculator transformer gets the same number of rows and column of the rasters to be processed. In this sense, the process gets a lot of faster. However, I do not know how to keep the result separate for all the polygons. I assumed that if it got the name from the feature type it would do the job.

 

 

Badge +8
You are using "fme_feature_type" (feature class name of the source polygon features) as join key in the FeatureJoiner. Since all the input features have the same feature class name, the joining operation in the FeatureJoiner would be equivalent to unconditional CROSS JOIN. i.e. <number of resulting features> = <number of Left features> x <number of Right features>. Naturally it takes a long time. Is it your intended operation?

 

If you are going to merge only features which are sourced by the same original polygon, you should use unique ID of the original polygon features as join key. Possibly "OBJECTID" or "_count" could be used.

 

 

I think I can solve this using a Group By "Clip_ID" in the RasterBanCalculator. Thanks for your help!

 

 

Reply