User:Tcncv/Geodist2

From Wikipedia, the free encyclopedia

xxTcncv/Geodist/output | This template is a currently in a proof-of-concept stage. It will calculate the distance (in km) between two geographic points using the Haversine formula. The result is currently an inexact computation that assumes a spherical earth and is accurate to within 0.5%. Further refinement may be possible but would require a large increase in complexity to implement Vincenty's formulae. Options and variations could also be implemented to accept alternate input parameter sets and to emit properly formatted and results at an appropriate precision.

Usage:

  • {{User:Tcncv/Geodist | latitude1 | longitude1 | latitude2 | longitude2 }} (positional)
  • {{User:Tcncv/Geodist |units = (future) |units2 = (future) |precision = (future) |latd1 = |latm1 = |lats1 = |latNS1 = |longd1 = |longm1 = |longs1 = |longEW1 = |latd2 = |latm2 = |lats2 = |latNS2 = |longd2 = |longm2 = |longs2 = |longEW2 = }}

All parameters are signed decimal values in degrees.

Examples:

  • 45 degrees lat = 4984.944
  • 45 degrees long = 5009.321
  • 45/45 lat/long = 6662.454
  • Paris to Berlin 878.593 km (Vincenty 878594.288 m)
  • Los Angeles to Perth 15023.658 km (Vincenty 15023747.718 m)
  • London to Cape Town 9635.44 km (Vincenty 9635442.275 m)