Reproject shapely features
Reproj is a minimalistic package designed to do one thing: reproject shapely features with a single call. GeoPandas has a simple to_crs
method for GeoDataFrames which we aim to mirror in ease of use for standalone shapely features. To be honest, this isn't difficult to do using pyproj and shapely with a couple of lines of code, but we decided to make it even easier.
Without reproj, you would use the following:
import pyproj
import shapely.ops
new_transformer = pyproj.Transformer.from_crs(4326, 32630)
utm_shape = shapely.ops.transform(new_transformer.transform, wgs84_shape)
With reproj, all you need is:
from reproj import reproj
utm_shape = reproj(wgs84_shape, 4326, 32630)
To see other practical ways of using reproj
for your application, check out the examples.
The latest version of reproj is available on PyPi, and can be installed with Pip:
pip install reproj
If you'd like to install the latest development (alpha) release, there may be a newer version on TestPyPi:
pip install -i https://test.pypi.org/simple/ reproj
To install this package from source, first clone this repository, then use pip to install:
git clone [email protected]:sgoodm/python-reproj.git
cd python-reproj
pip install .
New issues are always welcome, and if you'd like to make a change, fork the repo and submit a pull request.
We use Pytest and Coveralls to run unit tests and track code coverage of tests. If you submit code, please make sure it passes existing tests and adds relevant testing coverage for new features.
You can run tests and coverage checks locally, or you can fork the repository and utilize GitHub actions and Coveralls. To use GitHub actions and Coveralls, you'll need to add your forked repo to your own Coverall accounts and add your Coveralls token to your repository as a GitHub Secret (see below).
To run tests and coverage checks locally, you can use the following commands:
pip install pytest coverage
coverage run -m pytest ./
coverage html
There are three GitHub Secrets required to enable all of our GitHub Actions:
- COVERALLS_REPO_TOKEN - this is the API token for Coveralls, used for publishing code coverage reports
- TEST_PYPI_API_TOKEN - this is the API token for TestPyPi, needed for publishing alpha releases
- PYPI_API_TOKEN - this is the API token for PyPi, needed for publishing releases
Note: contributors do not need PyPi tokens; if you create a new release in a forked repo it will trigger a GitHub action that will attempt to publish to PyPi and fail.