I have two shapefiles, each with a set of lines generated from start and end points. One shapefile has the straight lines generated from the XY To Line tool, while the other has lines generated from a least cost path tool in Python.

enter image description here

I am looking for a method to quantify the error or distance between them, something that attempts to capture the overall variation between the two lines, not just the greatest or shortest distance between them (The shortest distance would also be 0 as they have the same start and end points). I have considered closing them into polygons, then dividing the area by the straight-line distance to get an 'average polygon height'. I have also considered converting one set of lines into points and then averaging the distances generated from the Near tool for each line feature. However to do this I would have to delete the end points as they are essentially false '0' distances.

Are there other methods to compare these features? An important aspect to note is that sometimes the least cost path line crosses over the straight line so I would often have two polygons.

  • 1
    There are infinitely many possible solutions to this problem. You could help narrow down the possibilities by explaining how you intend to use or interpret this measure of "distance," "error," or "variation."
    – whuber
    Apr 4, 2014 at 16:31
  • 1
    Basically it is just to put the difference created by the two methods (straight line vs least cost path) into context. It is not intended to show any sort of significance but to allow readers to mentally quantify the variation. If that makes sense? It is just to take the difference out of visuals and put some sort of number to it.
    – AlmaThom
    Apr 4, 2014 at 17:09
  • 1
    That leaves us little to go on. At least tell us what the intended basis of the comparison should be: will your readers be more interested in cost or distance?
    – whuber
    Apr 9, 2014 at 13:38
  • 1
    Would something like a Detour Index be appropriate? (See, for example, people.hofstra.edu/geotrans/eng/methods/ch1m3en.html)
    – Andy
    Jun 1, 2015 at 14:34

2 Answers 2


I know this is an old post, but I look at this and the first thing that comes to mind is sinuosity.

Sinuosity is defined by the length along a polyline divided by the shortest distance from start point to end point. This seems like a reasonable metric for determining the difference between the two lines.

There are several posts on this site which relate to sinuosity.

You can also read more about it on Wikipedia.

There is also a python toolbox for ArcGIS.

A straight feature will have an sinuosity index of 1. The more indirect the feature, the closer to 0 the sinuosity index.


Quick solution: Using the difference between the total lenghts of the two lines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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