Skip to main content
Question

Is it possible to calculate the average distance between two lines ?

  • February 10, 2022
  • 4 replies
  • 459 views

katt
Supporter
Forum|alt.badge.img+12
  • Supporter

I have a dataset of two lines and I want to calculate the average distance between them. I can use the NeighborFinder to get the closest distance between these two lines. (As you can see on the image the closest distance could only be an outlier.)

But I want to know how far they are from each other in average as these two lines are almost parallel. Is this possible to calculate ?

4 replies

danilo_fme
Evangelist
Forum|alt.badge.img+44
  • Evangelist
  • February 10, 2022

Hi @katt​ 

 

Have you tried to extract the points ( begin and end ) of the lines first?

 

 

 

Thanks in Advance,

 

Danilo


katt
Supporter
Forum|alt.badge.img+12
  • Author
  • Supporter
  • February 10, 2022
danilo_fme wrote:

Hi @katt​ 

 

Have you tried to extract the points ( begin and end ) of the lines first?

 

 

 

Thanks in Advance,

 

Danilo

Hey danilo_fme, I am not sure why to do so? Also the following scenario is possible. The outlier is not necessarily at the end/beginning of the line.image


hkingsbury
Celebrity
Forum|alt.badge.img+53
  • Celebrity
  • February 10, 2022

Heres one approach, Assume you name one line 'A' and one line 'B'

imageOn line A use the iterative snipper and split into X number of lines. then extract the first coordinate and use those as the origins in the Rotator. Rotate the line 90 degrees. These lines (we'll them 'C') are now perpendicular to line A.

imageNow extend C a suitable distance to be sure they intersect both lines A and B.

image 

Then using an intersector 'cut' C into three parts, then use a spatial filter to find the C segments that fall between A and B

imagenow calculate the length of the cut C segments and use a StatisticsCalculator to get the average length of all the C lines.

 

Have a look at the attached workbench :)


takashi
Influencer
  • February 11, 2022

Hi @katt​ , here is another approach. ​The basic concept is:

average distance = area between the two lines / longer axis length of the area

The attached workspace is an implementation example.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings