Metadata-Version: 2.1
Name: parenx
Version: 0.4.8
Summary: GeoJSON network simplification using raster image skeletonization and Voronoi polygons
Author-email: Will Deakin <will.deakin@crinstitute.org.uk>
Project-URL: Homepage, https://github.com/anisotropi4/parenx
Project-URL: Issues, https://github.com/anisotropi4/parenx/issues
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: geopandas
Requires-Dist: pyogrio
Requires-Dist: rasterio
Requires-Dist: shapely
Requires-Dist: scikit-image

# parex
Simplify (or "pare") a GeoJSON network ("nx") using raster image skeletonization an Voronoi polygons

This uses image skeletonization or Voronoi polygons to simplify network, and output GeoPKG layers corresponding to the input, simplified and primal network. Where a primal network only contains straight line segments

The sample data set is of the Princes Street in Edinburgh, kindly shared by Robin Lovelace

## Installation
To install the following will install the project into an activated `python` virtual environment:

    (venv) $ pip install parenx

This places the `skeletonization.py` and `voronoi.py` scripts into the executable search path

## Examples
A `bash` helper script `run.sh` and example data is available under the `sitepackage` project directory under `venv`. The exact path varies with module and `python` version

### Skeletonization
The following creates a simplified network by applying skeletonization to a buffered raster array in `output.gpkg`
    
    (venv) $ ./skeletonize.py data/rnet_princes_street.geojson
   
### Voronoi
The following creates a simplified network by creating set of Voronoi polygons from points on the buffer in `output.gpkg`
   
    (venv) $ ./voronoi.py data/rnet_princes_street.geojson

### Simple operation
The `run.sh` script sets a python virtual environment and executes the script against a data file in the `data` directory

    $ ./run.sh

The `run.sh` script optionally takes a filename and file-extension. To simplify a file, say `somewhere.geojson` and output to `GeoPKG` files `sk-simple.gpkg` and `vr-simple.gpkg`
    
    $ ./run.sh somewhere.geojon simple

### Locating the `run.sh` script
To copy the `run.sh` script into your local directory the following could help

    $ find . -name run.sh -exec cp {} . \;


## Notes
Both are the skeletonization and Voronoi approach are generic approaches, with the following known issues:

* This does not maintain a link between attributes and the simplified network
* This does not identify a subset of edges that need simplification
* The lines are a bit wobbly
* It is quite slow
