Skip to main content
Hi All,

 

Does anyone know of a good way to compare two datasets and find lines that are somewhat parallel?

 

 

The lines in question are not perfectly parralel; so more like this example:

 

 

 

I have a notion of using a buffer on one of the lines and seeing whether the other line intersects and if so by how much.

 

But is there a better (or other) way? Thoughts welcome.

 

Thanks,

 

Jonathan
There is no one way to do this and state the rate of "paralellism".

 

But you can aproach it somewhat in different ways.

 

 

If u want a orthogonal projection of one line to the other, for instance.

 

 

You can use segmentor on one line. Create a counter on the aquired segments.

 

Then extract the (start and end)points of these segements and use these to find the neighbours on the other line so you can segment that one as well.

 

 

Create a counter on the aquired segments. Then chopp them with vertex = 2. Calculate angle for each and then use statistics calculator to find average, and deviations.

 

 

Now you have data per segment collected so you can compare their data.

 

 

Just one way to try and do it..

Hi Gio,

 

Hmmm, good thought.

 

Another possible way (from a colleague) - chop the lines up into segments and snap them together. Then group the line segments back together and see which line "parallel" line was snapped to the most.

 

 

I suppose each have their advantages and disadvantages.

 

Thanks,

Jonathan


Here's the approach I would consider using (and have used in the past) 
  • Buffer each line. I don't know the scale of your dataset so use your discretion.
  • Calculate the area of the buffered features.
  • Calculate the percent overlap of each feature with either the custom Percent Overlap transformer in the FME Store (1Spatial I belive) or do your own custom approach.
  • With either approach, decide on a number (i.e. 80% overlap) of what you consider to be parallel and set a TestFilter to filter only those lines that meet your requirements.

The problem is, that there is no way relating any segment to another if there is no or lesser similarity.

 

 

"Chopp the line in to segemnts" is the same as using segmentor and then copping them...

 

You have to match segemnt on both lines.

 

Problem is how do you wish to do this? Orthogonal projection? Horizontal? (in your picture i would certainmly do no vertical...lol)

 

I go for orthogonal.

 

But and idea would be to test the "mayor" orientation of a line before projection.

 

 

Area buffering is very innacurate. You first have to decide buffersize, wich is very influential on the overlapsize. You could use a boundingbox aproach on 2 linked linesegments...but then you would have to link them first...based on...same problem as sementing/chopping.

 

If you use buffering, you must use the area overlap as a rasteroverlap, not only the overlap counts but also wich distance from both lines. Like overlapping heatmaps, or othe type of overlay.

 

In that case i sugest not just buffer, but serial/multi buffering.

 

 

 
Here is the first strategy i mentioned. I only used 10 segments, but you get the idea.

 

 

 

 

In this one neighbour searcher on midpoint of base is used. (bottom polyline is the base in this picture) I just used Inkscape to draw some "samish" curves for input.

 

The angel is overal angle of polylinepiece. So if i would increase resolution etc..

Reply