0
$\begingroup$

I have been trying to wrap my head around this formula here: https://www.movable-type.co.uk/scripts/latlong.html#bearing . The formula is calculating bearing from one coordinate to another. I was hoping I could just use calculated x and y values (later provided into arctan at the end of the formula) as pure component-wise distance measurements (in meters) from the origin point. I was hoping I could use the calculated x and y components since they provide an accurate bearing from the origin point.

However, I am not too versed in 3d polar based math. My feeble attempt was to simply multiply each of the components by R (radius of the planet), which got me close to the actual value, but isn't quite right.

To test how close my values were, I tried a pair of coordinates (y, 0.0) & (y, 1.0) (latitude, longitude) where y = [-89 to +89] and compared the known distance measurement with the faulty distance measurement as a ratio and got the following graph:

error radio graph

So the only points where simply multiplying the components by R (the radius of the planet) become accurate are when the origin point approaches the poles of the planet.

$\endgroup$
  • $\begingroup$ Those x and y components actually correspond to 2 of the components of the 3D vector joining your two lat,lon points in cartesian ENU reference. Those aren't 2D components on the surface of the globe. The z-component equals cos φ1 * cos φ2 * cos Δλ + sin φ1 * sin φ2 - 1. But this doesn't describe a great-circle. It's a straight line, which is probably not what you're looking for. $\endgroup$ – FSimardGIS Nov 8 '18 at 2:49
  • $\begingroup$ You can use the haversine formula to calculate distances. But for the components of that distance, as you can see, it's not that simple. You can't use 2D geometry on the surface of a sphere. Plus, the bearing is usually changing along a great-circle. The x and y component in the atan2 function for the bearing only relate to the initial bearing. $\endgroup$ – FSimardGIS Nov 8 '18 at 2:57
  • $\begingroup$ @FSimardGIS Thanks for the reply. The use case I was going for was to performing something of a flattening projection given a static observation point with points of interest that are no further than 3 km away. I am aware that performing this projection yields seemingly non-consistent results in the 2D realm given that I move my stationary reference point due to the initial bearing changing as the point moves closer to the target point. Ultimately, my goal was to have the function yield a 2D vector that has its angle match the initial bearing and magnitude match the great circle distance. $\endgroup$ – jakebird451 Nov 8 '18 at 20:40
  • $\begingroup$ Have a look at the Azimuthal equidistant projection. This might be what you need. It maps everything from your chosen center point with the correct distance and bearing. $\endgroup$ – FSimardGIS Nov 8 '18 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.