Code Monkey home page Code Monkey logo

great_circle_distance's Introduction

Date created

2021-01-18

Great Circle Distance

Command line program that calculates "Great Circle Distance" based on latitude/longitude.

Description

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.

Dependencies

  • Python 3.7+
  • Libraries: pandas, numpy

Installation

  1. Clone this repo
  2. (Optional) Activate your virtual env. Run: pip install -r requirements.txt

Running the Program

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! :)

great_circle_distance's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.