Skip to main content

# Reshaper

Project description

# Reshaper

Splits and recombines shapefiles based on lat-long data.

## Installation

conda install -c conda-forge gdal pip install reshaper

## Usage

To split a state map based on a branch list, use:

reshaper state.shp branch.csv output.shp

–id <ID column> –lat <Latitude column> –lng <Longitude column> –col <Any additional columns to add>

The arguments are:

  • state.shp: path to the original shapefile

  • branch.csv: path to the CSV file with points data. The output shapefile will have one shape per row of this file

  • output.shp: path to the output shapefile

  • –id branchname: indicates that the branchname column holds the branch identifier. The values in this column must be unique

  • –lat col1: the col1 column holds the latitude in degrees

  • –lng col2: the col2 column holds the longitude in degrees

  • –col col3: add col3 column to the Shapefile attributes. You can specify multiple columns via –col

The CSV file should have at least these 3 columns: ID, latitude and longitude.

The program splits and re-combines shapes based the following logic:

  • If a state does not have a branch, assign it fully to the nearest branch

  • If a state has only one branch, assign it fully to that branch

  • If a state has multiple branches, split it between the branches and assign each broken state to the respective branch

The output shapefile attributes include the –id column and any other columns specified via –col.

## Release

Change the “version” in setup.py to “x.x.x”, commit and tag:

`bash git commit . -m"Describe features / bug fixes" git tag -a vx.x.x -m"one-line summary of release" `

To [distribute](https://packaging.python.org/en/latest/distributing.html), run:

`bash rm -rf build dist flake8 . python setup.py test python setup.py sdist bdist_wheel --universal twine upload dist/* `

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reshaper-1.1.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

reshaper-1.1.1-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file reshaper-1.1.1.tar.gz.

File metadata

  • Download URL: reshaper-1.1.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for reshaper-1.1.1.tar.gz
Algorithm Hash digest
SHA256 d950db11bbfb8b3b2210809df43fbe7889b822c835339881d3afa44ceccd6be4
MD5 82ba6dc2d9deae6eae567d5756e9c318
BLAKE2b-256 d04b77de0215aa8060ca9de5b8f90c1783aa33f90d71785e0df045aef79b1001

See more details on using hashes here.

File details

Details for the file reshaper-1.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: reshaper-1.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for reshaper-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 34a4afc989ae30e2e3a4c6c5dd9f0cd310b712ff53f25d3caa05589b7d467e4c
MD5 d47bad6777a904db55408346d064218e
BLAKE2b-256 835978dc17fd16f4bb81a0e5b28a198aba8822da6357e4691ae93ef7bf1cb447

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page