Calculate the distance between 2 points on Earth.
Project description
Haversine
Calculate the distance (in km or in miles) between two points on Earth using their latitude and longitude.
Example
Calculate the distance between Lyon and Paris
from haversine import haversine
lyon = (45.7597, 4.8422) # (lat, lon)
paris = (48.8567, 2.3508)
haversine(lyon, paris)
>> 392.2172595594006 # in kilometers
haversine(lyon, paris, unit='mi')
>> 243.71201856934454 # in miles
haversine(lyon, paris, unit='nmi')
>> 211.78037755311516 # in nautical miles
Installation
$ pip install haversine
Contributing
Clone the project
Install pipenv.
Run pipenv install
Launch test with pipenv run pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
haversine-2.0.0.tar.gz
(2.4 kB
view hashes)
Built Distributions
Close
Hashes for haversine-2.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 145b5941d9438fbea0ce67cbc1b786a94c8618bfde07272a6a568464e7f73cd9 |
|
MD5 | 263cedad58665dd30fa98aa45fa4d5a4 |
|
BLAKE2b-256 | 5b5d20ba253eedf6795b8ffca2615cea4d2bba0938e4c1fe019b7815aee2a154 |
Close
Hashes for haversine-2.0.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cff54bc5fc04a42e53a55d08199865fbdd6f8e7c8874e66193e7e4d8227735b |
|
MD5 | 423df80091f80b139e54f9f8d07e4057 |
|
BLAKE2b-256 | eac469f06be7f039b250837c7ed8f1e8fe8ca0f21a3533c3e896d1424b74ffef |