Metadata-Version: 2.4
Name: larzgeo
Version: 0.1.0
Summary: Geospatial basics in pure Python: haversine distance, bearing, geohash, bounding box, point-in-polygon. No GDAL/shapely, zero dependencies.
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzgeo
Project-URL: Repository, https://github.com/larz-scripter/larzgeo
Project-URL: Issues, https://github.com/larz-scripter/larzgeo/issues
Keywords: geo,geospatial,haversine,distance,geohash,gps,latitude,longitude,point-in-polygon,zero-dependency
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# larzgeo

**Geospatial basics in pure Python. Zero dependencies.**

The handful of geo operations most apps actually need - distance, bearing,
geohashing, bounding boxes, and point-in-polygon - without GDAL, shapely, or any
dependency.

```python
from larzgeo import haversine, geohash_encode, point_in_polygon

haversine(51.5074, -0.1278, 48.8566, 2.3522)      # London->Paris ~343 km
geohash_encode(57.64911, 10.40744, 11)            # 'u4pruydqqvj'
point_in_polygon((2, 2), [(0, 0), (0, 4), (4, 4), (4, 0)])   # True
```

## Why

- **Just the essentials, correct.** Great-circle (haversine) distance in km/mi/m/
  nautical-mi, initial bearing, `destination` (project a point), `midpoint`,
  `bounding_box` (to pre-filter a radius query cheaply), geohash encode/decode
  (tested against the canonical `u4pruydqqvj` vector), and ray-casting
  point-in-polygon that handles concave shapes.
- **No heavyweight geo stack.** GDAL/shapely are powerful and huge; for "how far
  is X from Y", "is this point in this area", and "give me a geohash", this
  installs anywhere in seconds.
- **Zero dependencies.**

## Install

```bash
pip install larzgeo
```

## Usage

```python
from larzgeo import (haversine, bearing, destination, midpoint,
                     bounding_box, geohash_encode, geohash_decode, point_in_polygon)

haversine(lat1, lon1, lat2, lon2, unit="km")     # or "mi" / "m" / "nmi"
bearing(lat1, lon1, lat2, lon2)                  # degrees, 0=N 90=E
destination(lat, lon, bearing_deg, distance)     # -> (lat, lon)
bounding_box(lat, lon, radius_km)                # (min_lat, min_lon, max_lat, max_lon)
geohash_encode(lat, lon, precision=12)
geohash_decode(hash)                             # -> (lat, lon)
point_in_polygon((x, y), [(x1, y1), ...])        # ray casting
```

## Tests

```bash
python -m unittest discover -s tests -v   # 17 tests incl. geohash vector + concave polygons
```

## The Larz stack

One of 30+ pure-Python, zero-dependency libraries at
[github.com/larz-scripter](https://github.com/larz-scripter).

## License

MIT (c) larz-scripter
