Metadata-Version: 2.1
Name: pyreproj
Version: 1.0.1
Summary: Python Reprojector
Home-page: https://gitlab.com/gf-bl/pyreproj
Author: Karsten Deininger
Author-email: karsten.deininger@bl.ch
License: GPLv3+
Keywords: web proj coordinate transformation
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Scientific/Engineering :: GIS
Classifier: Topic :: Utilities
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Requires-Dist: pyproj (<2.0.0)
Requires-Dist: shapely
Requires-Dist: requests

|build status| |coverage report|

Python Reprojector
==================

This is a simple python library for coordinate transformations between different projections. It uses the
`pyproj library <https://github.com/jswhit/pyproj>`__ as a wrapper for `proj.4
<https://github.com/OSGeo/proj.4>`__. The goal is to make transformations as simple as possible.

Usage
-----

Get transformation function
~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

    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
<https://docs.python.org/2/library/functools.html#functools.partial>`__ that can also be used as first
argument for `shapely.ops.transform <http://toblerity.org/shapely/shapely.html#shapely.ops.transform>`__.

Transform coordinates directly
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

    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
~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

    from pyreproj import Reprojector

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

.. |build status| image:: https://gitlab.com/gf-bl/python-reprojector/badges/master/build.svg
   :target: https://gitlab.com/gf-bl/python-reprojector/commits/master
.. |coverage report| image:: https://gitlab.com/gf-bl/python-reprojector/badges/master/coverage.svg
   :target: https://gitlab.com/gf-bl/python-reprojector/commits/master


Changelog
---------

1.0.1
~~~~~

https://gitlab.com/gf-bl/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


