Skip to main content

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(7.80071, 47.46614)
# returns: (2627299.6594659993, 1257325.3550428355)

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(7.80071, 47.46614)
p2 = rp.transform(p1, from_srs=4326, to_srs=2056)
p2.wkt
# returns: 'POINT (2627299.659465999 1257325.355042835)'

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

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

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

0.2.2

  • Fix dependency error

0.2.0

  • Add documentation

0.1.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 0.2.2

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 0.2.2
File Size Uploaded
pyreproj-0.2.2.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyreproj 0.2.2
File Interpreter ABI Platform
pyreproj-0.2.2-py2.7.egg Legacy Egg format - - Details

Total release size:13.6 kB

Release files / pyreproj-0.2.2.tar.gz

Download URL pyreproj-0.2.2.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
203f4bb37ef817fcae434b50f396d8939526e1d13078d1d11562c7c370d2614d
BLAKE2b-256 checksum
How to use checksums
43553edb892b972aef81eb9b6a2f99799a1640cc18cc91e285f84d68c3fdb3fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pyreproj-0.2.2-py2.7.egg

Download URL pyreproj-0.2.2-py2.7.egg
Size 8.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
906669d41548358b7144a849edeba5516cb797c04e12e7043473649cb48d4722
BLAKE2b-256 checksum
How to use checksums
5390190e4b20608553c588191aba9547a5801b2719ced3f695aabd65104853d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

3.0.0

2 release files

2.0.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

This release

0.2.2 This release

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