Skip to main content
Solved

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


goatboyboz
Contributor
Forum|alt.badge.img+5

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

Best answer by ctredinnick

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)))

View original
Did this help you find an answer to your question?

4 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+34
goatboyboz wrote:

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


goatboyboz
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • July 10, 2024

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

 


ctredinnick
Supporter
Forum|alt.badge.img+18
  • Supporter
  • Best Answer
  • July 10, 2024

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)))


goatboyboz
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • July 11, 2024

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings