I'm currently working on creating a data model that will allow the analyst to digitize two non-parallel lines of approximately the same length. Currently the methodology is to divide the lines into 11 points and avg the distances between the two lines.

Any suggestions on how to simplify this method and or automate the process, remember I'm creating the schema so I have full range to change what is and how it is being recorded?

Attached is an example of the problem. enter image description here

  • What's the magic behind the number 11? Would it also do 10 or 8 or 5 lines? Actually number of lines should be dependent on the length of the two lines?
    – ulrich
    Sep 2, 2015 at 14:53
  • Is there any assumption that the distance should be roughly orthogonal to the direction of the two lines? E.g., point 7b might be closer to 8a than 8b. Are you looking to get the distance to the closest points, or get the distance to the corresponding point (7a to 7b, 8a to 8b, etc.)?
    – user55937
    Sep 2, 2015 at 16:27

3 Answers 3


If you have full control over the algorithm and implementation, for a coarse approximation you could probably

  1. Get the coordinates of some points on your polylines in equal distance from the respective starting point
  2. Approximate a straight line through your points of each polyline (https://en.wikipedia.org/wiki/Simple_linear_regression)
  3. Get the distance between the points on the new lines, corresponding to 1a and 1b as well as 11a and 11b from your graphic and calculate the average

enter image description here

Note: this is about an algorithm, not about specific implementation.

  • 1
    I think that the average distance between the two blue lines (because they are straight) is actually just the average length of the two yellow lines. If that were the case, then there would be no need to discretize the line into points.
    – user55937
    Sep 2, 2015 at 16:47
  • Yes, this is the case. But still you need the linear regression of the black lines. Consider two convex black lines, starting close to each other then moving away from each other and going closer again. If you just take the distance between the start and end vertices of the original lines into account, you will unterestimate average distance.
    – ulrich
    Sep 2, 2015 at 18:41
  • Goodness! I didn't read your answer well enough. I just stated your third step.
    – user55937
    Sep 2, 2015 at 19:12

1) create a polygon with your two lines, the line between 1a and 1B, and the line between 11a and 11b

2) create the center line

3) divide the area of the polygon by the length on the center line. Note that you can use the average of the length of the two lines as an approximation if you don't want to compute the centerline.

  • What exactly do you mean by center line? How would you get it, roughly?
    – ulrich
    Sep 3, 2015 at 13:31
  • see here for what I mean gis.stackexchange.com/questions/29863/… For the algorithm, you can merge the Thiessen polygons derived from the vertices of each lines.
    – radouxju
    Sep 3, 2015 at 14:02
  • Not sure that is what I am asking for I need to know the overall average distance between line a & b, or maybe I'm missing what your saying. Sep 3, 2015 at 14:14
  • the average width of your polygon is the average distance between the lines. Just imagine that you take an infinity of points...
    – radouxju
    Sep 3, 2015 at 15:41
  • +1. This is correct answer. Divide by average of 2 lines
    – FelixIP
    Sep 4, 2015 at 10:29

So I have experimented with "Calculate distance band from neighbor count" a spatial statistics tool and it seems to be working. Have a few more test to run and hopefully this will answer the bill. Thanks for all the feedback so far though.

Your Answer

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

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