This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
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.
Solved! Go to Solution.
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!
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.
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.
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.