Skip to main content
Solved

How to calculate average azimuth of lines in sets of 1-3 lines.

  • September 6, 2021
  • 2 replies
  • 114 views

Forum|alt.badge.img+1

My situation is this. I have a number of lines in a gdp on top of which I have some points (with a unique id called nodename). I want to rotate these points based on the angle of the lines. What I have done so far to achieve this is to make a buffer around the points, clip the lines using the buffer. Use the horizontalanglecalculator to calculate the azimuth of the lines. However some points have 3 lines coming through them meaning I have 3 angles for 1 point. I need to calculate the average of the x number of angles for each nodename.

 

Can anyone help me with this? See the picture below.

 

Udklip 

Regards Rasmus

Best answer by nielsgerrits

  • Assign unique ID's to points called point_id using a UUIDGenerator.
  • Merge attributes when clipping, so the lines get the point_id attribute.
  • Clipped lines to StatisticsCalculator, calculate average, group by point_id, summary outputport.

Now you have one feature for each point with the average of the angle.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • Best Answer
  • September 6, 2021
  • Assign unique ID's to points called point_id using a UUIDGenerator.
  • Merge attributes when clipping, so the lines get the point_id attribute.
  • Clipped lines to StatisticsCalculator, calculate average, group by point_id, summary outputport.

Now you have one feature for each point with the average of the angle.


Forum|alt.badge.img+1
  • Author
  • 21 replies
  • September 6, 2021

That solved the problem perfectly. Thank you very much!