Skip to main content
Question

Compare two lines that intersect.

  • June 10, 2015
  • 2 replies
  • 55 views

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?
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

takashi
Celebrity
  • June 11, 2015
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

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • June 11, 2015
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.