Skip to main content

A simple Python package to calculate the minimum distance between two geographic points

Project description

min_distance

PyPI version Python Version

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

Vansh
GitHub | LinkedIn

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

min_distance-1.0.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

min_distance-1.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

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

Hashes for min_distance-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d49f3d433e52e3bd2d2a8d1ebba0ae8c7ebffd7f476f3f1a953321e2bac3a5e1
MD5 d231479a10c13bbf3ac190fa42605a91
BLAKE2b-256 de223914bd7bf2c731b6566423ba1aed6f3547ac29f0920326984e42be57a5e2

See more details on using hashes here.

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

Hashes for min_distance-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 248b6a218d53a926a9454d08485b9e86a2f3935fc78e5ed5ac5965963ccad654
MD5 14d02e003e108a1a39c1766331fd79d8
BLAKE2b-256 378e9613dd60b176c782fb0a7c0129b8047f1ffed96c7069a2656a609a4018b0

See more details on using hashes here.

Supported by

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