The roads in your data are sort of parallel, but not truly. I had to use a more complex process to find them.
The attached workspace contains the custom transformer FuzzyParallelLineFinder, which breaks the lines into small segments, then uses the NeighborFinder to find nearby line segments with a similar angle.
These matches are sent to a StatisticsCalculator to calculate the standard deviation of the distance between all the matching segments for all line pairs. The horizontal overlap for the matches is also calculated.
The lower the standard deviation on the segment distances, and the larger the overlap, the closer the lines are to being parallel to each other. The transformer picks the best match, but also includes a list of all the reasonable matches, along with the overlap and standard deviation, so you can choose your own best match, if you like.
The transformer has two parameters:
- Sampling Distance: the length of the test segments
- Search Distance: maximum distance for parallel lines
This process works best when the parallel lines start and end near the same point. The transformer provides the standard deviation of its best match as well, so you can use that to filter out poor matches.
The one downside of this process is that it is very slow. A large sampling distance will improve the speed, but at the cost of accuracy. If you are happy with the results, I will look into streamlining it by using Python for the list handling. If any other members here can suggest improvements, they are most welcome.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.