Simple implementation of the Haversine formula for calculating the distance between two locations on an earth mean radius sphere.
The program expects four arguments in a specific order, being:
- latitude of the first position
- longitude of the first position
- latitude of the second position
- longitude of the second position
where the values are given in decimal degrees.
The result is in meters.
The distance between the Brisbane GPO at 27.4679° S, 153.0280° E and the Sydney GPO at 33.8676° S, 151.2075° E may be determined by running:
haversine -27.4679 152.028 -33.8676 151.2075
As this is intended to be a simple implementation no error checking is performed.