This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Help us improve Python packaging - Donate today!
Project Description

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 History

Release History

0.2.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyreproj-0.2.2-py2.7.egg (8.7 kB) Copy SHA256 Checksum SHA256 2.7 Egg Aug 26, 2016
pyreproj-0.2.2.tar.gz (4.9 kB) Copy SHA256 Checksum SHA256 Source Aug 26, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting