Skip to main content
Hi There,

 

I have a road network polyline data with some dangle roads. I need to remove all the dangles using looping in FME. But the master catch comes here...I do not need to give the number of iterations myself. All the roads, having a free node should be looped out of the network spatially giving output of the present loop to the input of the next one regardless of the nnumber of loops. Attached Image can help better to understand more.

 

 

 

Please revert if i am not able to communicate properly.

 

Thanks and regards.

 

 

 
Hi

 

 

Sorry, I struggled with the same sentence as Pratap. What does the numbers mean?

 

 

As a general recommendation, I'd start with the TopologyBuilder.

 

 

David
In general Looping, the looper parameter pops "Maximum number of iterations(0 for infinity)", and the process iterates in the loops for certain number of times. Ex. In the image above, all the green road network segments will remove in the first iteration, all the red roads will iterate iin the second time, and so on...

 

The above output is a take from the WB which I have created, but I had set '2' for "Max no. of iterations", so WB took two loops.

 

I want the WB to run the iteration according to the road network. It should go through the loops untill all free nodes end, without any hard code values.

 

The WB should keep the loop till it finds the dangled road elements. As soon as, all the road elements are extracted out of the road network, the looping process should stop and my output would be all interconnected road (free of dangled ones). 🙂
In addition to Prataps suggestion using the NeighborFinder, there is also the MRF2DDangleRemover (3rd party license necessary) to consider.

 

 

David
Hi,

 

 

I suppose that your requirement is to remove "dangle" lines recursively from the network, so that the resulting network contains only lines belonging to a cycle or a circuit.

 

An interesting challenge. I would try that by creating a custom transformer with Loop.

 

e.g.

 

 

 

A "dangle" line touches a node that touches just one line. You can determine that a node touches how many lines by testing the number of elements of the "_node_angle{}" list created by the TopologyBuilder.

 

The SpatialFilter outputs "dangle" lines from the Passed port, "non-dangle" lines from the Failed port.

 

The FeatureMerger merges one "dangle" line to every "non-dangle" line unconditinally.

 

If a "dangle" line existed, all the "non-dangle" lines will be output from the Merged port of the FeatureMerger and go to the Input port (next iteration) through the Loop port.

 

Otherwise, they will be output from the NotMerged port --> Output port, and the iteration will finish.

 

Note that this custom transformer must be always linked because it contains blocking-transformers with Loop.

 

 

Takashi
Testing result. Red lines are the removed "dangle" lines.

 

Does it satisfy your requirement?

 


Hi Takashi,

 

 

I think you understood my problem. I guess that might be the right solution, but I think my WB is going in the infinite loop process. Your image attachment is perfect according to my requirement, but then I m not able to get through the right answer.
I can't find a possible reason that the custom transformer will fall into an infinite loop.

 

Compare your transformer definition and this (an improved version). (https://drive.google.com/file/d/0B0ufVP2t0eApODNfYnAyU0VNT0E/view?usp=sharing)
Well Thanks Takashi.

 

That is exactly what I wanted. I had dangles till 3rd degree of the road network and its working perfectly.

 

 

Regards. 🙂

Reply