Skip to main content

build status coverage report

Python Reprojector

This is a simple python library for coordinate transformations between different projections. It uses the pyproj library as a wrapper for proj.4. The goal is to make transformations as simple as possible.

Usage

Get transformation function

from pyreproj import Reprojector

rp = Reprojector()
transform = rp.get_transformation_function(from_srs=4326, to_srs='epsg:2056')
transform(47.46614, 7.80071)
# returns: (2627299.6594659993, 1257325.3550428299)

The arguments from_srs and to_srs can be one of the following:

  • Integer: value of the EPSG code, e.g. 2056

  • String: EPSG code with leading “epsg:”, e.g. ‘epsg:2056’

  • String: proj4 definition string

  • Object: instance of pyproj.Proj

The returned function is a functools.partial that can also be used as first argument for shapely.ops.transform.

Transform coordinates directly

from shapely.geometry import Point
from pyreproj import Reprojector

rp = Reprojector()

p1 = Point(47.46614, 7.80071)
p2 = rp.transform(p1, from_srs=4326, to_srs=2056)
p2.wkt
# returns: 'POINT (2627299.659465999 1257325.35504283)'

rp.transform([47.46614, 7.80071], from_srs=4326, to_srs=2056)
# returns: [2627299.6594659993, 1257325.3550428299]

rp.transform((47.46614, 7.80071), from_srs=4326, to_srs=2056)
# returns: (2627299.6594659993, 1257325.3550428299)

The arguments from_srs and to_srs can be one of the following:

  • Integer: value of the EPSG code, e.g. 2056

  • String: EPSG code with leading “epsg:”, e.g. ‘epsg:2056’

  • String: proj4 definition string

  • Object: instance of pyproj.Proj

Get projection from service

from pyreproj import Reprojector

rp = Reprojector()
proj = rp.get_projection_from_service(epsg=2056)
type(proj)
# returns: <class 'pyproj.Proj'>

Changelog

3.0.0

https://gitlab.com/geo-bl-ch/python-reprojector/milestones/3

2.0.0

https://gitlab.com/geo-bl-ch/python-reprojector/milestones/2

  • Update used version of pyproj (>=2.2.0)

1.0.1

https://gitlab.com/geo-bl-ch/python-reprojector/milestones/1

  • Set up deployment

  • Lock version of pyproj<2.0.0

1.0.0

  • Initial version

  • Features:
    • define projections by projection object, proj4 definition or EPSG code

    • get projection by service (e.g. http://spatialreference.org/)

    • get a transformation function from source to target projection

    • transform coordinates as list or tuple or a shapely geometry directly

Release files for pyreproj 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyreproj 3.0.0
File Size Uploaded
pyreproj-3.0.0.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyreproj 3.0.0
File Interpreter ABI Platform
pyreproj-3.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 11.1 kB

Release files / pyreproj-3.0.0.tar.gz

Download URL pyreproj-3.0.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e2c065321af3d49ef5d40ced1a6c40d421fdd44d4fe824ff72f47a94a21fe96a
BLAKE2b-256 checksum
How to use checksums
d99d0221e1bf851e0e49c83ff2a8bc2272a24448522c46a0b3198fd17eb33344
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release files / pyreproj-3.0.0-py2.py3-none-any.whl

Download URL pyreproj-3.0.0-py2.py3-none-any.whl
Size 5.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4f3ac8434275a6f0c5dd147136ad746f3fc5845d5590fc5659ba58711927f94b
BLAKE2b-256 checksum
How to use checksums
bce3913c1f174e5e3707b0291b6f46dea4ef297600fc2fbd69182ccbd6162b3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files

2.0.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page