Skip to main content
Question

Find a line within a line?

  • December 22, 2016
  • 7 replies
  • 131 views

cwarren
Forum|alt.badge.img

I've been trying to find lines that are on top of another line feature of the same class, but different lengths. I can currently identify any features of the same feature class that are duplicates of one another based upon geometry and/or attributes with the matcher and duplicate filter, but can't seem to figure out how to identify the shorter line segments that are within a line. Sometimes they have shared vertices and sometimes they will not.

7 replies

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • December 22, 2016

Hi @madwarren, the SpatialRelator might help you. Send all the line features to both the Requestor and the Supplier port, and set:

  • Tests to Perform: Within
  • Attributes that Must Differ: OID

You can then check the number of related suppliers for each output line to determine if the line was within another line.

Note that there could be a case where the SpatialRelator cannot detect the spatial relationship if the shorter line has vertices that are not shared by the longer line, because of unavoidable computational error. In such a case, consider transforming the Supplier lines to slenderlong polygons using the Bufferer with a slight buffer amount.


itay
Supporter
Forum|alt.badge.img+16
  • Supporter
  • December 22, 2016

Optionally use the SpatialFIlter, or as suggested buffering.


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • December 22, 2016

If there are not always shared vertices I've never found spatial relators/spatial filters alone to be very reliable for lines. I've always ended up having to buffer or similar (but that can sometimes bring its own issues). Spatial comparisons with a tolerance is high on my wishlist for this reason


cwarren
Forum|alt.badge.img
  • Author
  • December 22, 2016
takashi wrote:

Hi @madwarren, the SpatialRelator might help you. Send all the line features to both the Requestor and the Supplier port, and set:

  • Tests to Perform: Within
  • Attributes that Must Differ: OID

You can then check the number of related suppliers for each output line to determine if the line was within another line.

Note that there could be a case where the SpatialRelator cannot detect the spatial relationship if the shorter line has vertices that are not shared by the longer line, because of unavoidable computational error. In such a case, consider transforming the Supplier lines to slenderlong polygons using the Bufferer with a slight buffer amount.

@takashi That seems to be my issue. When the shorter line segment doesn't share any vertices it will not find the line to be "within" and therefore reports 0 _related_candidates. I will try to use your recommended buffering technique. Thanks for the help.

 

 

 


cwarren
Forum|alt.badge.img
  • Author
  • December 22, 2016
ebygomm wrote:

If there are not always shared vertices I've never found spatial relators/spatial filters alone to be very reliable for lines. I've always ended up having to buffer or similar (but that can sometimes bring its own issues). Spatial comparisons with a tolerance is high on my wishlist for this reason

That is my issue because the shorter line segments don't always share the same vertices. I will try the suggested buffering. Thanks for your help.

 

 


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • December 22, 2016

You can try this:

Use the LineonLineOverlayer and a Tester to test all line segments with _overlap = 2

Then route these as Candidate in the SpatialFilter (filter EQUALS) to compare to the originals lines.

All line segments that have _overlaps=2 and are EQUAL to an original completely fall within another line.


cwarren
Forum|alt.badge.img
  • Author
  • December 22, 2016

Thanks everybody for their suggestions and help with this matter. I went with a buffering technique. I ended up using a matcher to filter out geometry matches and if found send a single feature through. I then did a small buffer on those lines and send them into the spatial relator as the requestor. I set it up to "requestor contains supplier", attributes differ "OBJECT ID", and created a list with the Object ID's. Tested the output on _related_candidates >= 1.

Then I can identify the segments that are within a line from the list attached to the features.


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