3

I have a pandas DataFrame that contains three points's lat/lon and elevation.

I used the Vincenty's formula to calculate the distance between each pair. And now I want to calculate the angle of the triangle considering the elevation factor.

I have all the pair's distances and elevation data.

example: https://ibb.co/FK8FmQw

1

-Get ABC angle

4
  • 1
    Distances in geodesy are computed over the ellipsoid. There is a way to compute the initial azimuth of the geodesic from A to B, and the initial azimuth of the geodesic from A to C. Over the ellipsoid, because we need a mathematical surface to do that (we cannot calculate geodesics on the air). Then the ellipsoidal angle can be the subtraction between both initial azimuths. Commented Dec 16, 2019 at 23:23
  • 1
    In geodesy, if we want to take the elevation into account, we move to Cartesian coordinates and find Cartesian distances and angles. In topography and cartography, we project geodetic coordinates to a plane, we take into acount the geoid and move heigths to orthometric altitudes, and then we calculate Cartesian distances and angles from there. Commented Dec 16, 2019 at 23:23
  • Thanks! Are there any distances in which we can say that the elevation factor is irrelevant? for example for hights of lower than 1200 m and distances of up to 30 km Commented Dec 17, 2019 at 6:33
  • Nevermind! while converting the lat/lon to x,y I changed the used elevation in the elevation*earth radius calculation. this is because I'm using these coordinates as an aircraft coords, not earth location. Commented Dec 17, 2019 at 7:02

1 Answer 1

3

I would use the Geometric Definition of a Dot Product (using the notation from your link):

enter image description here

I don't exactly know how your DataFrame is formatted, but in Python:

import numpy as np

a = [BAx, BAy, BAz]
b = [cAx, cAy, cAz]
a_mag = np.linalg.norm(a)
b_mag = np.linalg.norm(b)

theta = np.arccos( np.dot(a,b)/(a_mag * b_mag))

Perhaps, put that in a function to apply across all the rows in your DataFrame.

6
  • 1
    Seems to me a very good approach if you consider the transformation of geodetic coordinates to Cartesian. Commented Dec 16, 2019 at 23:24
  • I didn't quite understand what the z param is? I have the point's Cartesian points but what is z? elevation? Commented Dec 17, 2019 at 14:21
  • 1
    @yovelcohen , yep. I was using z to represent elevation. so cAz is the difference in elevation between the points c and A. But be careful with units, the elevation and position should all be the same (meter, for example.)
    – Ryan
    Commented Dec 17, 2019 at 16:27
  • I should just add that it's not a good habit to capitalize a variable. Commented Dec 18, 2019 at 11:48
  • @Ryan , what do you mean by position should all be the same? the points are in x,y , the measuring unit doesn't matter, right? Commented Dec 18, 2019 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.