Question

Determining angle between neighboring points

  • 3 October 2022
  • 2 replies
  • 38 views

I am working with 2 point datasets. My objective is to add two extra fields to the attribute table of the first set of points (red), containing the angle in degrees between this point and both it's two neighboring points (green).

 

points_angleEach set of red and green points within the white constrainment share a unique Object-code so it is possible to use "group by".

 

I have tried LineBuilder but I haven't succeeded in drawing 2 seperate lines from each red point to both green points. I have only been able to draw a line that starts at the red point and travels through green point 1, and the green point 2.

 

I have tried Neigborfinder but i can't seem to get the correct information about the angle of the neighbors in relation to the base point.

 

Regards Kilian


2 replies

Badge +10

Hi @kilian020​, it might help if you had two sets of red dots for each portion. A process like this might work.

 

  1. create a line from one red to one green, and another from the other red to the other green.
  2. combine the two line segments into one at the red point to create a node
  3. you can get the angles of each line at a node if you 'Generate List From Input Edges' on the Nodes in the TopologyBuilder. The list attributes will be sorted by angle, increasing counter-clockwise from East. The angle between lines (first segments from the node) can be calculated something like this: (@Value(edges{1}.fme_arc_angle) - @Value(edges{0}.fme_arc_angle) )

 

or, you could check out the horizontalanglecalculator - a custom transformer. it seems like it can do what you need https://hub.safe.com/publishers/safe-lab/transformers/horizontalanglecalculator

--

If i've provided something helpful, please upvote the comment. If i've provided a solution, please mark it as 'Best Answer'. This helps the community find solutions when your question is referenced.

If I didn't provide a solution, please let me know if I can help further. Thanks! 🙂

Userlevel 3
Badge +33

NeighborFinder should do the trick. Generate a list. All angles and distances (and other information) will be written to the list. Distance and angle of one point are automatically added to the attributes, you can extract the distance and angle of the other point from the list.

Red_and_Green_Points

Reply