Skip to main content
Question

How to do spatial filtering against groups of filters from the same feature type?

  • November 13, 2020
  • 4 replies
  • 230 views

aguan
Contributor
Forum|alt.badge.img+11
  • Contributor

I have a feature type of polygons, namely A, and want to use it as the candidate in a SpatialFilter against another feature type of polygons as the filter, namely B. B consists of a few groups of polygons, each group has an unique group name. What I want to achieve is like looping through each group of polygons in B as one filter against the same candidate of polygons of A. I see the SpatialFilter has a "group by" parameter but it requires both the candidate and filter having the same group names, which is not the case here for the candidate. Seems a simple and reasonable scenario, but I can't figure out a way to do this. Any advice or hints are welcome.

4 replies

chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 16, 2020

Do you have a way of filtering which features need to belong to each group? If you can, then perhaps you can create a temporary attribute then use a Looping Transformer to get the job done? There's more on looping in the advanced training as well in case that gives you more ideas :)


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • November 17, 2020

So perhaps use SpatialRelator instead?

In the output Attributes Parameters: Create List -> B.GroupID

Then running a ListExploder + DuplicateFilter (A.ID, B.GroupID) on the output of that will tell you exactly which B.GroupIDs each Feature from A spatially related to.


aguan
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • November 18, 2020
bwn wrote:

So perhaps use SpatialRelator instead?

In the output Attributes Parameters: Create List -> B.GroupID

Then running a ListExploder + DuplicateFilter (A.ID, B.GroupID) on the output of that will tell you exactly which B.GroupIDs each Feature from A spatially related to.

@bwn, @chrisatsafe, I think the combined solution from you too might work. I need to run polygons in A against each group of B. So I will need to loop through each group in B to use the spatialrelator or spatialfilter. have not used looping before, will look into it.


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • November 19, 2020
aguan wrote:

@bwn, @chrisatsafe, I think the combined solution from you too might work. I need to run polygons in A against each group of B. So I will need to loop through each group in B to use the spatialrelator or spatialfilter. have not used looping before, will look into it.

As a general rule, looping is only required if the output from one iteration is required as an input to the next loop Eg. A sequence where need to multiply the previous number by 2 is: 1, 2, 4, 8, 16....

 

In FME, however, if your Feature Groups are independent from each other (which it sounds like they are), then generally workflows are designed to carry out processing in parallel.....and not in a looping sequence. I know with other Geoprocessing packages (Eg. ArcGIS ModelBuilder) looping with an iteration through a Feature selector "cursor" is necessary (and many of my ModelBuilder workflows had to use loops like this), but not so with FME generally.

 

So if there are 10 Groups of Polygons in B, and 1 Group of Polygons in A, then likely it only needs to be run within a single Transformer that processes what is in a logical sense 10 x 1 = 10 iterations through a single physical FME transformer that analyses all 10x1 combinations in parallel. All that is generally required is to keep the output result Attributes as B.GroupID vs A.ID(s) as the output from SpatialRelator so that this can be used as the input into downstream Transformers/Writers in parallel Groups with a Group By of {B.GroupID, A.ID}


Reply


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