Skip to main content
Solved

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


felipeverdu
Enthusiast
Forum|alt.badge.img+10

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.

Best answer by takashi

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.

 

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

10 replies

jneujens
Forum|alt.badge.img
  • April 30, 2018

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.


felipeverdu
Enthusiast
Forum|alt.badge.img+10
  • Author
  • Enthusiast
  • April 30, 2018

Hey

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


takashi
Evangelist
  • Best Answer
  • May 1, 2018

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.

 


felipeverdu
Enthusiast
Forum|alt.badge.img+10
  • Author
  • Enthusiast
  • May 1, 2018
takashi wrote:

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!

 


felipeverdu
Enthusiast
Forum|alt.badge.img+10
  • Author
  • Enthusiast
  • May 1, 2018
takashi wrote:

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?

 

 


takashi
Evangelist
  • May 1, 2018
takashi wrote:

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?

 

 


felipeverdu
Enthusiast
Forum|alt.badge.img+10
  • Author
  • Enthusiast
  • May 1, 2018
takashi wrote:
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

takashi
Evangelist
  • May 1, 2018
takashi wrote:

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.

 

 


felipeverdu
Enthusiast
Forum|alt.badge.img+10
  • Author
  • Enthusiast
  • May 1, 2018
takashi wrote:
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.

 

 


felipeverdu
Enthusiast
Forum|alt.badge.img+10
  • Author
  • Enthusiast
  • May 1, 2018
takashi wrote:
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!

 

 


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