Metadata-Version: 2.4
Name: r055y
Version: 0.1.0
Summary: Open source spatial analysis library with AI-ready GIS tools for hallucination-free spatial operations.
License: MIT
License-File: LICENSE
Requires-Python: >=3.8
Requires-Dist: fiona
Requires-Dist: geopandas
Requires-Dist: openpyxl
Requires-Dist: xlrd
Description-Content-Type: text/markdown

# r055y

An open source spatial analysis library built for AI-driven GIS workflows. Designed to give AI systems like Claude reliable, hallucination-free tools for spatial operations.

## Install

```bash
pip install r055y
```

## Functions

### `r.Intersect(input_layer, intersect_layer, output=None)`
Computes geometric intersection of input features against a polygon boundary.
- `input_layer` — point, line, or polygon (file path or GeoDataFrame)
- `intersect_layer` — polygon layer defining the intersection boundary
- `output` — file path to save result (`.gpkg`, `.shp`, etc.) — omit to return a GeoDataFrame

```python
r.Intersect("wells.shp", "boundary.shp", "result.gpkg")
```

---

### `r.Buffer(input_layer, distance, unit="meters", output=None)`
Buffers input features by a given distance and unit.
- `input_layer` — point, line, or polygon (file path or GeoDataFrame)
- `distance` — numeric buffer distance
- `unit` — `meters`, `km`, `miles`, `feet`, `usfeet`, `nautical miles`
- `output` — file path to save result — omit to return a GeoDataFrame

```python
r.Buffer("wells.shp", 1, "miles", "wells_buffer.gpkg")
```

---

### `r.Clip(input_layer, clip_layer, output=None)`
Clips input features to the extent of a polygon clip boundary.
- `input_layer` — point, line, or polygon (file path or GeoDataFrame)
- `clip_layer` — polygon layer defining the clip boundary
- `output` — file path to save result — omit to return a GeoDataFrame

```python
r.Clip("roads.shp", "county.shp", "roads_clipped.gpkg")
```

---

### `r.morph(input_path, output_path, **kwargs)`
Universal format translation. Converts between shp, gpkg, gdb, csv, xlsx, xls, dbf with automatic CRS handling, field name fixes, and multi-layer support.

- `input_path` — source file or geodatabase
- `output_path` — destination file. Extension sets the format. Use trailing `/` for directory output (one file per layer). Use dot notation for named layers: `roads.parcels.gpkg`
- `x_col`, `y_col` — column names for X/Y coordinates (auto-detected if not provided)
- `wkt_col` — column containing WKT geometry (auto-detected if not provided)
- `crs` — coordinate reference system e.g. `EPSG:4326` (required for tabular → spatial)

```python
r.morph("roads.shp", "roads.gpkg")
r.morph("county.gdb", "county.gpkg")
r.morph("county.gdb", "output_folder/")
r.morph("owners.csv", "owners.geojson", crs="EPSG:4269")          # auto-detects lat/lon cols
r.morph("owners.csv", "owners.shp", x_col="LONGITUDE", y_col="LATITUDE", crs="EPSG:4269")
r.morph("roads.gpkg", "roads.parcels.gpkg")
r.morph("data.json", "data.gpkg")                                  # auto-detects GeoJSON vs tabular
```

**Smart behavior:**
- GDB / GPKG with multiple layers → detects all layers automatically
- CRS mismatch → auto-reprojects
- Shapefile field name limit (10 chars) → auto-truncates with warnings
- Invalid output path → plain English error
- Empty layers → skipped with a warning, not a crash

---

## Changelog

### v0.1.1 — 2026-06-26
- Added `morph()` — universal format translation between shp, gpkg, gdb, csv, xlsx, xls, dbf, geojson, json
- Smart geometry detection — auto-scans columns for WKT, lat/lon pairs without user hints
- GeoJSON and JSON support — JSON auto-detects whether content is GeoJSON or tabular
- GeoJSON output always reprojects to WGS84 (EPSG:4326) per spec
- Auto-detects all layers in GDB and GPKG sources
- Auto-reprojects on CRS mismatch
- Shapefile 10-char field name truncation with warnings
- Directory output (trailing slash) writes one file per layer
- Named layer dot notation: `roads.parcels.gpkg`
- Clean architecture: InputSpec, OutputSpec, MorphEngine, _Reader, _Writer, _GeomHint

### v0.0.7 — 2026-06-25
- Added `Buffer()` with full unit support (meters, km, miles, feet, usfeet, nautical miles)
- Added `Clip()` for clipping features to a polygon boundary
- Standardized all function signatures to individual args (no more list inputs)
- All functions auto-reproject, validate geometries, and return plain English errors

### v0.0.5 — 2026-06-25
- Rebuilt `Intersect()` with full input validation and guardrails

### v0.0.4 — 2026-06-24
- Updated package description

### v0.0.3 — 2026-06-24
- Updated package description

### v0.0.2 — 2026-06-24
- Initial `Intersect()` function

### v0.0.1 — 2026-06-24
- Initial release
