HP Prime Forum

Full Version: geodesic coordinates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This HP Prime program demonstrates how to interact with a geodesic subroutine which calculates the relative azimuths and distance between two ground sites on an oblate planet. This program is "hard-wired" with typical geographic coordinates along with constants for the Earth. Please note that north latitudes are positive and south latitudes are negative. Also, azimuth is measure positive clockwise from north.

Here is the syntax for the geodesic subroutine.

EXPORT geodesic (lat1, lat2, long1, long2)

// relative azimuths and distance between two ground sites

// input

// lat1 = geodetic latitude of point 1 (radians)
// long1 = east longitude of point 1 (radians)
// lat2 = geodetic latitude of point 2 (radians)
// long2 = east longitude of point 2 (radians)

// output

// gdv(1) = azimuth from point 1 to 2 (radians)
// gdv(2) = azimuth from point 2 to 1 (radians)
// gdv(3) = geodesic distance from point 1 to 2
// (same units as req and rpolar)

The following is the output created by running this program.

program demo_geodesic

geodesic length and azimuths
----------------------------

distance 54972.2693252 meters
azimuth from 1 to 2 306.868159236 degrees
azimuth from 2 to 1 127.173630661 degrees
latitude 1 −37.9510334166 degrees
longitude 1 144.424867888 degrees
latitude 2 −37.6528211388 degrees
longitude 2 143.926495527 degrees
Reference URL's