Solved

Spatial Join linear feature with closest running a similar angle (Spatial Angle Join)

  • 10 July 2024
  • 4 replies
  • 61 views

Badge +3

Hi All,

Im trying to do a spatial join of attributes from the red line (running parallelish) to the black line, not the attributes from the red line running down Duke Street.

I have tried a range of things

  1. buffering the black line and seeing what it contains ( it contains a piece of Duke Street) and the parallel red line but i cant work out which record to take
  2. getting the polar angle of the lines and looking at the list of records that spatially join it - im struggling to sort the list to find the correct record. 

I think i need a Spatial Angle Join but am struggling with the logic on the lists

Any help or suggestions appreciated. 

Thanks Steve

icon

Best answer by ctredinnick 11 July 2024, 01:21

View original

4 replies

Userlevel 5
Badge +32

Hi All,

Im trying to do a spatial join of attributes from the red line (running parallelish) to the black line, not the attributes from the red line running down Duke Street.

I have tried a range of things

  1. buffering the black line and seeing what it contains ( it contains a piece of Duke Street) and the parallel red line but i cant work out which record to take
  2. getting the polar angle of the lines and looking at the list of records that spatially join it - im struggling to sort the list to find the correct record. 

I think i need a Spatial Angle Join but am struggling with the logic on the lists

Any help or suggestions appreciated. 

Thanks Steve

I haven’t tested it but have you tried the FuzzyParallelLineFinder? It’s a custom transformer maintained by Safe Software

Badge +3

Thanks Matt, 

Its not quite right in my use case ( but useful to know about).  I have gone down the neighbor finder route. I now have a list of neighboring lines appended to my original line. I also have a polar angle ( 0-180) for each line.  What i cant figure out is now to get the item in the list with the closest polar angle to my original line.

 

Say my original line is running 45 degrees. I now have a list with x items in it all with a polar angle. How do i get the line with the closest to 45 degrees ( say my lines are 23,127 and 40 degrees) I want the 40 degree one to be selected. 

 

I tried using a listsorter and taking the 1st item of the list ( but this doesn't work as i want to item with the angle closest to 45 , not closest to zero.

 

Thanks steve

 

Userlevel 4
Badge +17

My first suggestion when seeing transferring attributes between lines is to recommend my custom transformer LineOnLineRelator. Although it doesn’t have specific control for the angle between lines, just picks what’s best, and falls off if the lines are too different in angle.

If you want to work with your angle list, I could recommend using a trig function.

ABS(SIN(2*(angle+45))) has minimums at 45 and -45 degrees which you can sort your list by.

@abs(@sin(2*@degToRad(@Value(angle)+45)))

Badge +3

Many Thanks Chris,  I love your LineOnLineRelator. 

 

This looks like a winner!!! I appreciate your help and publishing the cutsom tool

Thanks Again, 

Steve

Reply