Question

Looping through buffered polygons against a base layer. tips/help

  • 10 March 2015
  • 8 replies
  • 7 views

Hello all,

 

 

Firstly, sorry for adding another looping question!

 

 

I have a shape file of buffered polygons and I would like to perform an AreaOnArea action to them against a second basemap shapefile.

 

 

These buffers overlap one another in places but I would like to compare each one individually against the second shapefile.

 

 

I've tried to set up a loop and I don't think I have set it up correctly. I've limited the features to read to 10 for testing and running it using inspection but it doesn't seem like it will create a single shapefile in the end as I had 10 different layers open in inspector.

 

 

Also, do I have the loop iteration parameters set correctly? I have just under 5000 buffered polygons to go through and I don't want it to get stuck in an infinte loop or anything else that could cause it to crash.

 

 

I've uploaded screenshots of my workbench

 

 

Thanks for taking the time to look at this!

 

 

 


8 replies

Badge +3
Hi,

 

 

The AreaOnArea is a blocking transformer. It will collect all input and then proces it.

 

 

If you want to test the buffers one by one against the 2ndShapefile, you must use a grouping strategy.

 

 

Create an ID on the buffers using a counter.

 

 

Get the total number of buffers using a statisticcalculator and merge the result (use a summary, for you want only to pass the total count ) to the 2nd Shapefile (unconditional option if you use fme2015. Else use unconditional merge form store)

 

Clone the 2ndshapefile by this number.

 

Rename the copynumber attribute to same name is the ID you created, with value copynumber+1. (count attribute has to have same start as the copynumber attribute).

 

 

Now use the AreaOnAreaOverlayer and GroupBy the ID you created.

 

 

 
Userlevel 2
Badge +17
Hi,

 

 

Another thought. Assuming that the second shape features (base areas) don't overlap each other. It's also using the grouping strategy.

 

1) Use a Counter to add unique identifier attribute (sequential number, e.g. "ID")  to the buffer areas.

 

2) Add a SpatialRelator to the workspace; send the base areas to the Requestor port, send the buffer areas to the Supplier port, and sete "OVERLAPS" to the Tests to Perform parameter.

 

3) Use a ListExploder to explode the base areas output from the SpatialRelator on the "_relationships" list.

 

4) Send the ListFound features and the buffer areas to the AreaOnAreaOverlayer, and set "ID" to the "Group By" parameter. 

 

 

 

Takashi
Badge +3
pic of  my suggested solution

 

Badge +3
with overlapping testers now..(coloured objects are the outputs)
Badge +3
selection (blue dotted) of object proofs they are processed individualy..
Badge +3
Hi, in my example the Counter transformer should be after the Sampler. The Areabuilder should then be GroupedBy "_count".

 

 
Badge +3
Hi again.

 

I made a workspace that requires no cloning and usses a "looping and Grouping" strategy together with.

 

 

The inputs need to enter the custom transformer separately to work, so it has 2 inputs.

 

(will not work if u have them enter trough a single input)

 

 

The workspace (mostly sample data creation btw..)

 

 

 

and the core .. the customloop for the AreaOnArea overlayer:

 

 

 

 

Greetz,

 

Gio
Hello, I've been away for the last few days so only now had a chance to catch up with this. I got it to work by using a feature holder to my original workbench after the custom transformer.

 

 

Takashi, your assumption was correct that the second layer does not have any overlaps.

 

 

Gio, Thank you for your diagrams! I'll spend some time looking over them to try and get my head around them as I have mainly been creating relatively simple workbenches in the past and this is my first adventure into looping.

 

 

Thanks again to the both of you.

 

 

Reply