I have 2 different shapefiles that each have railroad track on them. Most of the track being displayed is the same, but since it is coming from 2 different sources, the physical lines themselves are about 0.5 feet apart. The goal of my analysis is to find what segments of track are common between the 2 shapefiles and also what segments of track only exist in one shapefile or the other.

I tried doing select by location: within a distance of 1 foot, which solves most of my problem, but there is an issue. Wherever one track crosses the other, the two segments on either side of the node are also selected, because they are within 1 foot of the other track (due to crossing). Thus, if a segment of track that only exists in shapefile A crosses a segment of track that exists in shapefile B, the 2 line segments of track A on either side of track B will be selected.

I only want common track to be selected, thus if A and B run parallel to each other and are within 1 foot, I want them to be selected. Is there any way to do this without also selecting track segments that cross the track?


1 Answer 1


The tool that does what you want is the Detect Feature Changes tool. I think it first became available at 10.2, and there is an enhanced version at 10.4 that evaluates the relative line directions as well as proximity and parallel segments. It worked well for me when I wanted to replace a portion of my network of roads with a more accurate set of lines, but still preserve the attributes of my original network. Here is a picture of my original network (blue lines) compared to the target geometry (pink lines):

Original Network compared to New Network

Here is the result after running a script that changed the shape of my original lines to match the target geometry identified by the Detect Feature Changes tool. The Green lines are from my realigned network laying on top of the target geometry. The pink arrows (target line direction) and green arrows (realigned line direction) show that the 10.4 version allowed me to maintain the line orientation of my original network using the Flip Line tool on the set of lines flagged by the Detect Feature Changes tool:

Realigned Network compared to Target Network

Finally here is a comparison of the original lines (blue lines) to the realigned network (green lines):

Realigned Network compared to the Original Network

The Detect Feature Changes tool also optionally creates a relationship table that links the FIDs of the two networks and tells you when the line segments match 1:1, 1:M, M:1, M:N, deleted from the original network or new in the target network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.