Metadata-Version: 2.4
Name: geombox
Version: 0.1.0
Summary: A unified python package to parse geospatial data formats and compute typed bounding boxes.
Author-email: Alejandro López <al3jandro.lopez@proton.me>
License-Expression: MIT
Project-URL: Homepage, https://github.com/yourusername/geombox
Project-URL: Repository, https://github.com/yourusername/geombox
Project-URL: Documentation, https://github.com/yourusername/geombox#readme
Project-URL: Changelog, https://github.com/yourusername/geombox/blob/main/CHANGELOG.md
Project-URL: Bug Tracker, https://github.com/yourusername/geombox/issues
Keywords: geospatial,geometry,bbox,gis,wkt,geojson,shapefile
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
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: Topic :: Scientific/Engineering :: GIS
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: shapely>=2.0.0
Requires-Dist: geopandas>=0.14.0
Requires-Dist: fiona>=1.9.0
Requires-Dist: pyproj>=3.6.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Requires-Dist: pre-commit>=3.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=6.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
Dynamic: license-file

# geombox

A unified, typed Python library to parse geospatial geometries from various formats (WKT, GeoJSON, Shapefiles) and compute their bounding boxes (BBox) and geometries in a target Coordinate Reference System (reprojecting to EPSG:4326 by default).

## Installation

You can install `geombox` using `pip`:

```bash
# Build the wheel
pip wheel --no-deps -w dist .

# Install the built wheel
pip install dist/geombox-*.whl
```

## Features

- **Unified API**: Parse multiple geometry representations (`WKT`, `GeoJSON`, `Shapefiles`) with a single function call.
- **Typed Representation**: Bounding boxes are returned as a typed, immutable `dataclass` (with helpers to export to tuple or GeoJSON dictionary formats).
- **Automatic Reprojection**: Safely handles coordinates reprojection using `pyproj` and `shapely`. High precision bounding box calculation reprojects the entire geometry prior to computing the bounds to prevent edge curvature errors.
- **Robust Exception Handling**: Custom, descriptive error types for parsing errors, reprojection failures, or invalid geometries.

## Usage

```python
import geombox

# Calculate a bounding box from a WKT string (automatically reprojected to EPSG:4326)
wkt_input = "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))"
bbox = geombox.get_bbox(wkt_input)
print(bbox)
# BoundingBox(min_x=10.0, min_y=10.0, max_x=40.0, max_y=40.0, crs='EPSG:4326')

# Convert the bounding box representation
print(bbox.as_tuple())    # (10.0, 10.0, 40.0, 40.0)
print(bbox.as_geojson())  # GeoJSON dict polygon

# Parse and reproject to UTM zone 14N
utm_bbox = geombox.get_bbox(wkt_input, target_crs="EPSG:32614")
print(utm_bbox)

# Get the full reprojected shapely geometry
geom = geombox.get_geometry(wkt_input, target_crs="EPSG:4326")
print(geom.wkt)
```
