2021-01-18
Command line program that calculates "Great Circle Distance" based on latitude/longitude.
This command line program calculates "Great Circle Distance" based on latitude/longitude, ie. the distance between two points on the surface of the Earth following the curvature.
Please note: In the program the shape of the Earth is viewed in a simplified manner, namely as a perfect sphere with radius of 6,371 km.
The user can specify the number of locations. If not specified, a default data file with ten REAL locations will be used. If specified, the given number of locations will be generated randomly. The names will then just be generic (Location1, Location2, etc.) and the locations will spread randomly around the surface of the Earth.
The minimum numeric argument is 2 since we are looking at distances.
The result is printed to the command line and will contain:
- All distinct combinations of two locations and the distance between them. The list of combinations is sorted in ascending order on distance.
- The average distance. And the two locations with distance closest to the average distance.
- Python 3.7+
- Libraries: pandas, numpy
- Clone this repo
- (Optional) Activate your virtual env. Run: pip install -r requirements.txt
Run from the root directory:
python main.py
or
python main.py 10
With the first command the locations will be the ten REAL locations in the file ´places.csv´.
With the second command generic places randomly located around the Earth will be generated. The number of places is based on the input argument and can be chosen freely, but he minimum allowed is 2.
Enjoy! :)