## Great circle distance on a sphere

I slapped this one together during a stay in Antarctica to keep track of the line-of-sight distance to a balloon payload. For some reason I couldn't easily or quickly find something like this on the web.

This program is about as simple as they come: you enter the longitude and latitude of two points on the planet (in degrees) and it tells you the shortest distance between them (the great circle distance) in kilometer.

### Assumptions:

The code assumes a spherical earth of exactly 6371km radius (the old FAI spherical model). The real radius is different, of course. The generally agreed-upon rotational ellipsoid (WGS 84) has 6378.137km at the equator and 6356.752km at the pole, but to be accurate one would have to add the altitude of the balloon above the surface of the earth and around 40km this actually makes more of a difference than taking the earth to be spherical. At the pole, the one error actually cancels almost 40% of the other error.

Just keep in mind that this will only be accurate to within a kilometer (or a few in extreme cases). If higher accuracy is required, one would generally need to take the actual terrain-shape into account anyways.

### Online Version!

If you don't need a downloadable standalone program but just want to verify a few coordinates, there is now an online version of this program that does the same things on the fly right here on the web.

### How do I run it?

This program is written in plain Tcl/Tk - which means it'll run on all computers with a working installation of Tcl/Tk. Most unixoid OS have TCL by default, but it exists for Windows and MacOS as well (and it's free). I have tested it under two linux flavors, Sun/Solaris and WinXP, but as there are no particular tricks in it, I see no real reason why it shouldn't run just fine on other platforms. Try it and let me know.

In Linux: You make it executable and call it by name.

In Windows (all this has been tested on 98SE, let me know if other versions differ): You'll need to have Tcl installed. For example ActiveState's ActiveTcl, which you can download right here. This is the usual self-extracting installer. Lonlat should start when you "open" it in explorer. If the installer fails to associate ".tcl" extensions with wish.exe, you can rightclick on it, choose "open with", select "other", navigate to your wish.exe (something like C:\Tcl\bin\wish.exe by default) and open it with that.