Question

How to find lines that have the same start and end point

  • 27 June 2013
  • 2 replies
  • 9 views

I have a dataset of lines, what i want to find and spit out into a csv file are the line records which run on top of each other and have the same start and end point. I initially started using the lineonlineoverlayer but it pulls every line that runs on top of each other regardless of the start and end points being the same.

 

 

Is there and easy way for me to find  just the lines i want? and which transformers should i use?

2 replies

Userlevel 2
Badge +17
Hi Trent,

 

 

Extract the coordinates of  start (x0, y0) and end (x1, y1) of every line via CoordinateExtractor (Index = 0 for start, -1 for end). Then you can group lines by x0, y0, x1, y1 when applying the LineOnLineOverlayer.

 

If you don't care of the orientation (i.e. the order of start and end), arrange (x0, y0), (x1, y1) in the same rule. For example, swap (x0, y0) and (x1, y1) if x0 is greater than x1. And if you need to consider some tolerance, adjust decimal places of every coordinate value via the AttributeRounder.

 

Hope this helps.

 

 

Takashi
Userlevel 4
Hi,

 

 

if the lines are identical all the way (not just start/end point), you could also consider the Matcher.

 

 

David

Reply