The Geographic Distance Matrix Generator is a platform-independent Java application that implements the same powerful suite of spherical functions as the Perpendicular Distance Calculator to compute all pair wise distances from a simple list of geographic coordinates.
In the fields of phylogeography and landscape genetics, biologists attempt to detect patterns in the distribution of genetic variation across different spatial scales. The most commonly known process is isolation by distance (IBD), under which genetic similarity decreases with geographic distance. Barriers to migration of organisms can hinder gene flow, thus increasing genetic distance, even if populations are not far apart. With the increasing availability of mobile GPS technology, every scientist can obtain latitude-longitude coordinates for target organisms, which can later be used in regression analyses in conjunction with genetic distances, or matrix associations with permutations for statistical testing, as well as multiple matrix correlations when testing for more complex biogeographic and ecological scenarios (Mantel and partial Mantel tests, respectively).The Geographic Distance Matrix Generator can be used to easily generate distance matrices needed for these types of analyses.
Visit our main page to learn more about the Center for Biodiversity and Conservation.
Download
Platform independent jar | GeographicDistanceMatrixGenerator_v1.2.3.zip (88.3 KB)
Source code | https://github.com/persts/GeographicDistanceTools
Citation
If you use the application on data that results in a publication, report, or online analysis, we ask that you include the following reference:
Ersts,P.J.[Internet] Geographic Distance Matrix Generator(version 1.2.3). American Museum of Natural History, Center for Biodiversity and Conservation. Available from http://biodiversityinformatics.amnh.org/open_source/gdmg. Accessed on .
Documentation
On most systems, you should be able to activate the application by double clicking on the JAR file. The application can also be started by opening a terminal window or command prompt and entering
java -jar GeographicDistanceMatrixGenerator_v1.2.3.jar
to manually launching the application. GeographicDistanceMatrixGenerator_v1.2.3.jar requires JRE version 1.5.x or higher. If the application does not load, check your version of java by opening a command prompt or terminal window and typing java -version. You can also just download the newest version of Java from http://java.com
If you have a large number of sample locations you will have to launch the application by hand to increase the amount of memory available for use by the java runtime environment. This can be done by opening a terminal window or command prompt and entering
java -Xmx512 -jar GeographicDistanceMatrixGenerator_v1.2.3.jar
which will allocate 512 MB to the virtual machine.
Preparing Your Data
The Geographic Distance Matrix Generator expects your coordinates to be stored in a simple tab or comma delineated text file. Each line of the input file represents one location. The Geographic Distance Matrix Generator expects to find exactly three fields per line: label, latitude and longitude; remember no spaces can appear in the label name. The order of these fields is important and coordinates are expected to be in decimal degrees. If a line contains more than or less than three fields, the file will not be loaded. A sample input file can be found here.
Converting Geographic Coordinates to Decimal Degrees
Geographic coordinates are often recorded in degrees, minutes, and seconds (DMS). DMS is an intuitive format to look at and read but cumbersome to work with computationally, thus most programs and equations only accept geographic coordinates in decimal degrees (DD). You convert degrees, minutes, seconds to decimal degrees with the following equation
Geographic coordinates that are west of the Prime Meridian or south of the Equator are represented as negative values. It is important to fully complete the conversion to from DMS to DD before applying the "-" sign to coordinates in the Western and Southern Hemispheres. Precision is very important with decimal degrees, you should store coordinates with at least 6 significant digits (1 meter ~ 0.00000898 DD).
Example
The Geographic Distance Matrix Generator is a very lightweight and simple to use application. Save these data to a file called sample.txt and launch the Geographic Distance Matrix Generator.
Once the application is open, click the Browse button to open a file dialog. Navigate to and select the sample.txt file, then click the Open button to load the file.
That is about it! The sample file contains five points, intersection of the Prime Meridian and Equator, zero latitude and longitude, and the surrounding 1 degree intersections. You can change your output units by selecting meters, kilometers, nautical miles, degrees or radians from the pull down menu. Three formats are available for the output matrix and the matrix will automatically be regenerated once you select a different output unit or matrix format.
The matrix in the display window is tab delimited so you can simply select the matrix and paste it into a text file or your favorite spreadsheet program. You can either use the mouse to select the matrix or you can set the focus the display area and press ctrl-a or apple-a to select everything in the display.
A Quick Note on Your Choice of Spheroids
The Geographic Distance Matrix Generator assumes that the Earth is a perfect sphere. The application uses the semi-major axis of the WGS84 reference system as the default radius of the Earth. WGS84 is the default reference system (datum) used by most GPS receivers, and should be fine for most calculations, however, if your localities were collected in a different reference system you should use semi-major axis for that reference system as the radius of the earth. To change the radius, just type in the new radius in the text box next to the spheroid pulldown menu. The radius is expected to be in meters.
Additional information on spherical calculations can be in the documentation for the Perpendicular Distance Calculator.
This library and software are based upon work partially supported by NASA under award No.NAG5-12333 and No.NNG05G041G. Additionally, this library and application were also prepared under award No. NA04AR4700191 and No. NA05SEC46391002 from the National Oceanic and Atmospheric Administration, U.S. Department of Commerce. The statements, findings, conclusions, and recommendations are those of the author(s) and do not necessarily reflect the views of the National Oceanic and Atmospheric Administration or the Department of Commerce.