A simple Python package to calculate the minimum distance between two geographic points
Project description
min_distance
Calculate the minimum distance between two geographic points (latitude and longitude) using the Haversine formula in Python.
Features
- Simple and lightweight Python package
- Accurate distance calculation on Earth’s surface (in kilometers)
- Easy to integrate into any Python project
- Well-tested with unit tests included
Installation
Install via pip:
pip install min_distance
Usage
from min_distance import calculate_min_distance
lat1, lon1 = 40.7128, -74.0060 # New York
lat2, lon2 = 51.5074, -0.1278 # London
distance_km = calculate_min_distance(lat1, lon1, lat2, lon2)
print(f"Distance: {distance_km:.2f} km")
API Reference
calculate_min_distance(lat1: float, lon1: float, lat2: float, lon2: float) -> float
Calculate the minimum distance between two points on the Earth specified by latitude and longitude.
-
Parameters:
lat1,lon1: Latitude and Longitude of the first point in decimal degrees.lat2,lon2: Latitude and Longitude of the second point in decimal degrees.
-
Returns: Distance in kilometers as a
float.
Development
Want to contribute? Feel free to open issues or submit pull requests!
Run tests with:
python -m unittest discover -s tests
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file min_distance-1.0.1.tar.gz.
File metadata
- Download URL: min_distance-1.0.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d49f3d433e52e3bd2d2a8d1ebba0ae8c7ebffd7f476f3f1a953321e2bac3a5e1
|
|
| MD5 |
d231479a10c13bbf3ac190fa42605a91
|
|
| BLAKE2b-256 |
de223914bd7bf2c731b6566423ba1aed6f3547ac29f0920326984e42be57a5e2
|
File details
Details for the file min_distance-1.0.1-py3-none-any.whl.
File metadata
- Download URL: min_distance-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
248b6a218d53a926a9454d08485b9e86a2f3935fc78e5ed5ac5965963ccad654
|
|
| MD5 |
14d02e003e108a1a39c1766331fd79d8
|
|
| BLAKE2b-256 |
378e9613dd60b176c782fb0a7c0129b8047f1ffed96c7069a2656a609a4018b0
|