8

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

Evil Genius
  • 6,289
  • 2
  • 27
  • 40
  • 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 02 '15 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 02 '15 at 16:27

3 Answers3

5

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.

ulrich
  • 1,130
  • 8
  • 23
  • 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 02 '15 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 02 '15 at 18:41
  • Goodness! I didn't read your answer well enough. I just stated your third step. – user55937 Sep 02 '15 at 19:12
2

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.

radouxju
  • 49,636
  • 2
  • 71
  • 144
  • What exactly do you mean by center line? How would you get it, roughly? – ulrich Sep 03 '15 at 13:31
  • see here for what I mean http://gis.stackexchange.com/questions/29863/creating-centrelines-from-road-polygons-casings/29865#29865 For the algorithm, you can merge the Thiessen polygons derived from the vertices of each lines. – radouxju Sep 03 '15 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. – Mark McCallister Sep 03 '15 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 03 '15 at 15:41
  • +1. This is correct answer. Divide by average of 2 lines – FelixIP Sep 04 '15 at 10:29
  • Not sure if this works with each form of the lines. If the center line has the same length, but differing area of the polygon, the result will vary, Actually it gets the correct value only for straight lines or am I wrong? Consider two opposite convex lines... – ulrich Sep 04 '15 at 11:56
  • if the center line has the same length, but the area between the two lines is different, then you want the results to vary because the average distance will be different. Second, I don't see why it wouldn't work with two opposite convex lines when you divide by the length of the centerline. However, taking the average of the two lines will indeed be an issue in this case (this is why I recommend the use of the centerline, even if the average of the two lines is a good approximation in most of the cases. – radouxju Sep 04 '15 at 12:11
0

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.