This is a tool for calculating haversine distances between coordinates. This is a tool being used as part of a personal project and thus may have limited applicability beyond that. The tool is designed to take 2 CSV files (lets say A and B) and compute all paired distances from A to B.
In this project I make use of Kristofer Berggren's rapidcsv header. This is available [here]{https://github.com/d99kris/rapidcsv}. This source code is made available under BSD 3-Clause license.
General usage is as below:
./haversines file1.csv file2.csv [options]
The output will compute the distance from every point in file1 to every point in file2 and return it in a list written to out.csv.
Options are only required if using a different format csv.
-
-vverbose mode. Prints input parameters or defaults where not specified. -
-cand-rturn off column headers and row headers. CSVs are assumed to have both of these as the first row and column respectively. If row headers are available, the output file will use these names toto show each pair. If column headers are available, you can specify column names for lat/lon. -
-nnearest point mode. Use this to return only the nearest pairs of points. All points in file1 will be in the output, and each corresponding nearest point in file2. -
ssingle csv mode. Use this if distance matrix on a single csv is required. Will skip$D(x,x)$ and one of$D(x,y),D(y,x)$ in the output file. -
-aand-Aspecify the column name for the latitudes. Use-afor file1 and-Afor file2. Alternatively can use-iand-Ifor the column index. If no row headers, the first column is indexed 0, otherwise the second column is indexed 0. -
-band-Bspecify the column name for the longitudes. Use-bfor file1 and-Bfor file2. Similarly as above can use-jand-Jto specify the column index.