Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Distance Line Edge to Line Edge

jessicamccloud
5 - Atom

Is there a way to get the distance between two line objects edge to edge rather than the centroids? I am trying to determine the minimum distance between 2 horizontal lines on a map. 

4 REPLIES 4
SydneyF
Alteryx Alumni (Retired)

Hello @jessicamccloud!

 

To get the distance between endpoints, the first step is to create individual end points from your lines using the Spatial Info tool. Then, you transpose the data so that all your points are in the same column, split the data by line using the filter tool, and use the Find Nearest tool to calculate the shortest distance between your end and start points. I have attached a sample workflow- please let me know if it is not what you were thinking!

Ned
Alteryx Alumni (Retired)

Its clearly not documented will enough, but the distance tool will do exactly this.  If you pass in 2 lines, it will find the nearest distance between the 2 lines.  You can demonstrate this by having 2 distance tools - picking the fields in opposite directions.  The checkbox "Create Nearest Point Inside of Polygon" will output the nearest point on the line.  The blow image will demonstrate.

 

These 2 lines also have the nasty behavior that the nearest points are not on any end point, so a solution based on end points will not work.  So again, trust the distance tool - it does what you want.  Attached is a workflow that demonstrates this and also the problem with the end point methodology.

LineNearest.png

jessicamccloud
5 - Atom

Thank you for the response! I have a related follow-up question about the Find Nearest tool. Is that distance calculated the same way? For my project, we need to know the closest line as well as its distance. I'm wondering if I can use the Find Nearest tool to accomplish both. I initially dismissed this because the Find Nearest tool seems to only calculate from the centroid of the lines. 

Ned
Alteryx Alumni (Retired)

The distance tool will only compute from the centroid - the indexing problem gets really difficult.  It will however compute to  the nearest spot on a line on the destination.

Labels