|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Great Circle Menu
|
Here is a perl script that takes a text file
containing a number of location co-ordinates and outputs a matrix of the
distances between every point. The script was written using perl 5.004
(MS Windows download), though it should work with other versions.
It still needs some work doing to it, but even so I hope it will prove
useful to somebody. You can open it in any text editor, by-the-way. Using the ScriptThe format of the text file is such that each line in the file contains a single point thus[ Commas and spaces marked ^SP are significant ] location,locationid,deg min [N/S], deg min [E/W]location is a string which will be used when outputting the matrix locationid is a arbitrary number, not currently used deg are the degrees of latitude or longitude deg are the minutes of latitude or longitude N/S Indicates whether the latitude is North or South of the equator. E/W Indicates whether the latitude is East or West of the Greenwich meridian. Note these two fields are case sensitive. In fact any values other than "S" or "W" will be silently taken as North and East respectively. Format errors will cause the script to exit immediately, with the offending line number indicated. There is no range checking performed. Values can be floating point ( aka "decimals" ). All distances are in Kilometres, because that's what the rest of the world uses - sorry Yanks. Example: An input file containing Armenia,9,40 00 N, 45 00 E Will yield a CSV producing a matrix thus;
Download the script . Download the sample input file
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||