The `haversine` library (current version 2.9.0) calculates the great-circle distance between two points on Earth given their latitude and longitude, using the Haversine formula. It supports various units like kilometers, meters, miles, and nautical miles, and is commonly used in geospatial analysis and navigation. It maintains an active development status with regular updates.
pip install haversineVerified import paths — ran on the pinned version, not inferred.
Calculate the distance between two geographical points (Lyon and Paris) in kilometers, miles, and meters. Points are provided as (latitude, longitude) tuples.
Replace `miles=True` or `nautical_miles=True` with `unit=Unit.MILES` or `unit=Unit.NAUTICAL_MILES` (or their string equivalents 'mi' / 'nmi').
Always ensure your point tuples are structured as `(latitude, longitude)`, for example `point1 = (lat1, lon1)`.
Validate input coordinates to ensure they are within the valid ranges. Alternatively, use the `normalize=True` parameter in the `haversine` function to automatically clamp out-of-range values: `haversine(point1, point2, normalize=True)`.
Upgrade to Python 3.5 or newer. The `python_requires` is `>=3.5` for current versions.
Ensure that the latitude and longitude values passed as `point1` and `point2` are within their valid ranges. The library can also automatically normalize points with `normalize=True`.
Pass the coordinates as two tuples, each containing (latitude, longitude). For example: `haversine((lat1, lon1), (lat2, lon2))`.
Rename your local `haversine.py` file to something else (e.g., `my_haversine_script.py`) to avoid conflicts with the installed package.
Explicitly import `Unit` alongside `haversine` from the library: `from haversine import haversine, Unit`.
No dependency data recorded yet.