Skip to main content
Hello,

 

 

I would like to compare two lines that intersect AND contain the same attribute value. Out of these lines I would like to return the longest line. Would anyone have any ideas how to do this?
Hi,

 

 

An idea. Assuming that the attribute name is "_group_id", whose value is identical among the lines that should be compared.

 

(1) Add sequential number attribute (e.g. "_count") to the lines as a temporary ID with a Counter.

 

(2) Send the lines to both Requestor port and Supplier port of a SpatialRelator.

 

- Group By: _group_id

 

- Tests to Perform: <select a predicate that fits to the required "intersect">

 

- Attribute(s) that Must Differ: _count (exclude self comparison)

 

(3) Filter the output lines which have intersected in the same group by a Tester.

 

- Test Clause: 0 < @Value(_related_candidates)

 

(4) Calculate the length of each Passed line.

 

(5) Sort the lines by length descending.

 

(6) Select the longest line for each group by a DuplicateRemover.

 

- Key Attributes: _group_id

 

 

The data flow looks like this.

 

 

Takashi
When lines intersect eachother, this might yield more then 1 candidate.

 

If the attribute wich might have a identical value is not unique, you might want to _relationships{} list for the test and then test for the longest one.

Reply