Skip to main content
Solved

'Subtract' one line feature class from another

  • December 14, 2012
  • 9 replies
  • 93 views

Thre should be a simple solution for what I am trying to do, but for some reason I can't think of it.

 

 

I have two polyline feature classes.  Feature Class 'A'  is made up of segments of the Feature Class 'B'.  However, not all segments of a line from 'B' exist in 'A'.  Some segments are missing.  What I need to do is compare the two to find out what is missing in 'A'.  Basically just looking for a "subtract" feature for lines.  I know how to do this for polygons, but not for lines. 

 

 

Any ideas would be much appreciated!  I feel like it is really simple and I'm just overlooking the easy solution!

Best answer by oakey

You could try buffering the line segments in "B" with a butt end then use the clipper.  Any thing "Clipped_Outside is your missing sections in "A"
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.

9 replies

fmelizard
Safer
Forum|alt.badge.img+18
  • Safer
  • December 14, 2012
I would try the change detector or the matcher first.

 

Itay

  • Author
  • December 14, 2012
I looked at those but the problem is that they check for exact geometry matches.  For instance, I have a line that is 1000ft long in one dataset and that line is split into maybe 50 segments in the other dataset.  The ChangeDetector shows 1 feature deleted and 50 added.

 

 

What I am after is the "leftover" features that are not included in the segmented dataset.  So the 1000ft line, for example, may have a few segments that are not in the other dataset.  I want to identify those segments.

takashi
Influencer
  • December 15, 2012
Hi,   How about the following trick?   Class 'A' --> LineJoiner --> Bufferer --> SpatialFilter [BASE]   Class 'B' --> SpatialFilter [CANDIDATE]   LineJoiner joins 'A' lines to form longer lines. Set very small value (e.g. 0.000001) to Bufferer's "Buffer amount" parameter, Bufferer will create long-slender polygons surrounding the joined lines. Select "CONTAINS" at SpatialFilter's "Tests to perform" parameter. Run the workspace. 'B' segments missing on 'A' lines will go to [FAILED] port of SpatialFilter.

fmelizard
Safer
Forum|alt.badge.img+18
  • Safer
  • December 16, 2012
I imagine that the segmented dataset lines have more than 2 coordinates so I would try the following:

 

  • Segment the non segmented dataset (1000ft line) with the chopper set to 2 vertices.
  • Use a spatial relator with the newly segmented dataset as base and the segmented dataset as candidate, test for equals.
  • Use a tester or testfilter to filter out the newly segmented lines which are not equal to the originally segmented dataset (_related_candidates != 1)
  • recombine the new segments if needed using the linejoiner

 

Hope this helps.

 

 

 


jpvo
Participant
Forum|alt.badge.img+1
  • Participant
  • December 17, 2012
How about an intersector with SeparateColinearSegment = YES? You filter the output list and you should get what you need.

 

I would use a coordinate rounder beforehand to make sure you work with the appropriate tolerance.

 

 

JP

takashi
Influencer
  • December 17, 2012
Or, after splitting 'B' lines into segments, CommonSegmentFinder may be applicable.

  • Best Answer
  • December 18, 2012
You could try buffering the line segments in "B" with a butt end then use the clipper.  Any thing "Clipped_Outside is your missing sections in "A"

  • Author
  • December 18, 2012
Thanks everyone for all the responses!  I tried a number of the different ideas and most of them worked but there were some lines that didn't make it through that should have.  The best result set for me was to use a buffer of 0.000001 on data set "B" with end cap set to None.  I then clipped data set "A" and the Outside + Clipped Outside ports gave me the data I was looking for.

 

 

Thanks again,

 

 

Jerrod

I was able to perform a geographic subtraction using two Choppers, a PointOnAreaOverlayer, and a Matcher.

 

 

Step 1:  Send the first linear dataset to a chopper with vertex = 1.  This will convert your linear dataset to a point dataset.

 

 

Step 2:  In parallel, send the first linear dataset to a chopper with vertex = 2.  This will convert your multi-segment lines to simple segments.

 

 

Step 3.  Send the second linear dataset and the point data from Step 1 to a PointOnAreaOverlayer.  This will split all of the lines in the second linear dataset at the nodes of the first linear dataset.

 

 

Step 4.  Send the line ouptput from the PointOnAreaOverlayer and the line output from the chopper in Step 2 to a Matcher.  The Matcher will find all instances where the line segments from the first dataset overlap with the line segments from the second dataset.

 

 

Step 5.  Send the Not Matched output from the Matcher to your Writer.

 

 

Dataset 1 => Chopper (vertex =1 ) => PointOnLineOverlayer (via Point)

 

 

Dataset 1 => Chopper (vertex = 2) => Matcher

 

 

Dataset 2 => PointOnLineOverlayer (via Line) => Matcher => Not Matched

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