i´m currently dealing with gps data combined with precise altitude measurement.
I want to calculate the distance between two consecuting points. There is a lot
of information out there about calculating distance between two points using the WGS84 ellipsoid and so on.
however, i did not find any information that takes Altitude changes into account for this
distance calculation.
does anyone know about some websites, papers, books etc. that describes such a method?
thanks
edit: Sql Server 2008 geographic extensions also neglect altitude information when calculating distance.
Best Answer
I implemented a WGS84 distance function using the average of the start and end altitude as the constant altitude. If you are certain that there will be relatively little altitude variation along your path this works acceptably well (error is relative to the altitude difference of your two LLA points).
Here's my code (C#):
In practice we've found that the altitude difference rarely makes a large difference, our paths are typically 1-2km long with altitude varying on the order of 100m and we see about ~5m change on average versus using the WGS84 ellipsoid unmodified.
Edit:
To add to this, if you do expect large altitude changes, you can convert your WGS84 coordinates to ECEF (earth centered earth fixed) and evaluate straight-line paths as shown at the bottom of my function. Converting a point to ECEF is simple to do:
Edit 2:
I was asked about some of the other variables in my code:
LatLonAltTransformer
is a class I used to convert from LatLonAlt coordinates to ECEF coordinates and defines the constants above.