Skip to main content

Calculate the distance between 2 points on Earth.

Project description

Haversine Build Status

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


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 details)

Uploaded Source

Built Distributions

haversine-2.0.0-py2.py3-none-any.whl (3.7 kB view details)

Uploaded Python 2 Python 3

haversine-2.0.0-py2-none-any.whl (3.7 kB view details)

Uploaded Python 2

File details

Details for the file haversine-2.0.0.tar.gz.

File metadata

  • Download URL: haversine-2.0.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.13

File hashes

Hashes for haversine-2.0.0.tar.gz
Algorithm Hash digest
SHA256 c40cd6359c91d9516d279144c1af968b069e9e87aebc957d4fa56c113678cca6
MD5 246380b223c4070e87229b22588f5e28
BLAKE2b-256 a647cc01408df40819c8b7526519ebcc3fa7b3392f53c4b51173fc90220eebe9

See more details on using hashes here.

File details

Details for the file haversine-2.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: haversine-2.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.13

File hashes

Hashes for haversine-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 145b5941d9438fbea0ce67cbc1b786a94c8618bfde07272a6a568464e7f73cd9
MD5 263cedad58665dd30fa98aa45fa4d5a4
BLAKE2b-256 5b5d20ba253eedf6795b8ffca2615cea4d2bba0938e4c1fe019b7815aee2a154

See more details on using hashes here.

File details

Details for the file haversine-2.0.0-py2-none-any.whl.

File metadata

  • Download URL: haversine-2.0.0-py2-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.13

File hashes

Hashes for haversine-2.0.0-py2-none-any.whl
Algorithm Hash digest
SHA256 1cff54bc5fc04a42e53a55d08199865fbdd6f8e7c8874e66193e7e4d8227735b
MD5 423df80091f80b139e54f9f8d07e4057
BLAKE2b-256 eac469f06be7f039b250837c7ed8f1e8fe8ca0f21a3533c3e896d1424b74ffef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page