Metadata-Version: 2.4
Name: shptools
Version: 0.2.0
Summary: A collection of tools for working with shapefile (ESRI Shapefile) vector files
Author-email: aaronchh <aaronhsu219@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/AaronOET/shptools
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# SHPTOOLS

A collection of Python tools for working with shapefile (ESRI Shapefile) vector files.

> **GDAL Installation**: GDAL is required for this package. For conda environments, use `conda install gdal` to install GDAL. For non-conda environments, download the appropriate wheel file from [https://github.com/cgohlke/geospatial-wheels/releases](https://github.com/cgohlke/geospatial-wheels/releases) to install GDAL.

## Installation

```bash
pip install -e .
```

## Features

- **shpinfo**: Check shapefile properties (geometry, projection, extent, fields)
- **shpasprj**: Assign a projection to shapefiles without modifying geometry
- **mvshp**: Relocate shapefiles by setting a new upper-left coordinate

## Usage

### Command-line

```bash
# List all available commands
shptools-info

# Check properties of all SHP files in the current directory
shpinfo -a

# Check a single file
shpinfo -i parcels.shp

# Assign a projection to all SHP files (metadata only, no geometry change)
shpasprj -a --epsg 3826
shpasprj -a -e 3826

# Relocate a shapefile to a new upper-left coordinate
mvshp -i parcels.shp -x 500000 -y 2500000
```

### Python API

```python
from shptools import shpinfo, shpasprj, mvshp

# Report shapefile properties
shpinfo.check_shp_info("parcels.shp")

# Assign projection metadata without touching geometry
shpasprj.assign_projection("parcels.shp", epsg=3826)

# Relocate a shapefile's geometry to a new upper-left coordinate
mvshp.relocate_shapefile("parcels.shp", x=500000, y=2500000)
```

## Notes

- `shpasprj` and `mvshp` automatically create a `SHP_BAK/` directory with backup copies before modifying files.
- GDAL must be installed separately via conda or a pre-built wheel; it is not listed in `requirements.txt` as it cannot be reliably installed via pip on all platforms.
