Hi
Whats the easiest way to get the Azimuth to a compass bearing?
Thanks
Hi
Whats the easiest way to get the Azimuth to a compass bearing?
Thanks
#Function to return the north azimuth bearing of a line segment in degrees
def NorthAzimuth(x1,y1,x2,y2):
degBearing = math.degrees(math.atan2((x2 - x1),(y2 - y1)))
if (degBearing < 0):
degBearing += 360.0
return degBearing
That is Python to return compass bearing. Math functions return arithmetic azimuth already.
#Function to return the north azimuth bearing of a line segment in degrees
def NorthAzimuth(x1,y1,x2,y2):
degBearing = math.degrees(math.atan2((x2 - x1),(y2 - y1)))
if (degBearing < 0):
degBearing += 360.0
return degBearing
That is Python to return compass bearing. Math functions return arithmetic azimuth already.
...and I know it uses atan2 the 'wrong way round' but that is how the direction reversal works...
@bruceharold Hi there, i to require the azimuth angle to be converted into a bearing where 0 degrees is North. How do i add the above python script into my workbench...i'm not too familiar with python it's self but am good at following instructions :)
Any help would be much appreciated.
Cheers
Trent
@bruceharold Hi there, i to require the azimuth angle to be converted into a bearing where 0 degrees is North. How do i add the above python script into my workbench...i'm not too familiar with python it's self but am good at following instructions :)
Any help would be much appreciated.
Cheers
Trent