Question

Read orientation from line?

  • 7 February 2022
  • 4 replies
  • 63 views

Badge +14
  • Contributor
  • 120 replies

The ultimate goal here is to orient overlapping lines in the same direction so that later offsets will come out neat.

The lines have been processed in multiple steps and when I apply a OrientationExtractor it says: no_orientation. Is there another way to get the orientation, other than the Topologybuilder which is quite slow and requires a few extra calculations? Also is the Orientor the only way to rewrite orientations to a line, or is it possible to copy it somehow with something like a FeatureMerger?


4 replies

Userlevel 1
Badge +21

Lines do not have an orientation that can be extracted with the OrientationExtractor. What do you mean by Orientation in this case? If you need the angle of the line, the HorizontalAngleCalculator(custom transformer) might help you here

Userlevel 2
Badge +17

Hi @aron​,

A quick way to determine the orientation of a reasonably straight line is to subtract the beginning X and Y coordinate from the end X and Y. A + or - X value gives you the East/West orientation, while +/- Y gives you North/South. If both orientations match, then the lines are OK.

If your lines are close, but not exact, you may want to take the extra step of testing the difference in values between the lines. For example, two lines oriented almost exactly up/down may have a small negative X value for one and small positive value for the other. If the X difference falls below a tolerance, you can consider them equivalent.

Badge +14

Lines do not have an orientation that can be extracted with the OrientationExtractor. What do you mean by Orientation in this case? If you need the angle of the line, the HorizontalAngleCalculator(custom transformer) might help you here

Thanks for the clarification! A better wording would have been 'direction', as in a line has a start and a end. I need to make sure two overlying lines have the same direction.

Badge +14

In case it is of use to anyone, I solved it the following way:

  • Intersector (could also use LineOnLineOverlayer)
  • Snipper, to shorten the lines an inkling and not have any "duplicate positions"
  • CoordinateExtractor x2, to get start and end (0 and -1)
  • InlineQuerier, to find "flipped" lines
  • Orientor, to flip the strays

 

Reply