Search code examples
gisdata-conversionelevationazimuth

how to get azimuth and elevation from enu vectors


How do you get the azimuth and elevation from one enu vector to another enu vector?

A link to a formula or piece of code would be helpful. I'm not getting much information at all when searching.


Solution

  • You can calculate the azimuth and elevation angles between East-North-Up vectors (x,y,z) and (u,v,w) using the following:

    1. Subtract the vectors: (x,y,z) - (u,v,w) = (x-u,y-v,z-w) = (x',y',z')
    2. Compute the azimuth angle: a = arctan(x'/y') = arctan((x-u)/(y-v))
    3. Compute the elevation angle: e = arctan(z'/y') = arctan((z-w)/(y-v))

    In Python:

    v1 = np.array([3,4,4])
    v2 = np.array([1,2,6])
    v = v1 - v2
    
    a = np.degrees(np.arctan(v[0]/v[1]))
    e = np.degrees(np.arctan(v[2]/v[1]))
    
    print('azimuth = '+str(a)+', elevation = '+str(e))
    

    Output:

    azimuth = 45.0, elevation = -45.0
    

    Azimuth and Elevation

    (Image Source)