|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(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
<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(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
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. 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/geo-bl-ch/python-reprojector/badges/master/pipeline.svg
:target: https://gitlab.com/geo-bl-ch/python-reprojector/-/commits/master
.. |coverage report| image:: https://gitlab.com/geo-bl-ch/python-reprojector/badges/master/coverage.svg
:target: https://gitlab.com/geo-bl-ch/python-reprojector/commits/master
Changelog
---------
3.0.0
~~~~~
https://gitlab.com/geo-bl-ch/python-reprojector/milestones/3
- Replace deprecated transform method
https://pyproj4.github.io/pyproj/stable/gotchas.html#upgrading-to-pyproj-2-from-pyproj-1
- Drop support for Pyhton 2.7, 3.5, 3.6 and 3.7
2.0.0
~~~~~
https://gitlab.com/geo-bl-ch/python-reprojector/milestones/2
- Update used version of pyproj (>=2.2.0)
.. warning:: The order of lon/lat values has changed to lat/lon!
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
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/geo-bl-ch/python-reprojector",
"name": "pyreproj",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "web proj coordinate transformation",
"author": "Karsten Deininger",
"author_email": "karsten.deininger@bl.ch",
"download_url": "https://files.pythonhosted.org/packages/d9/9d/0221e1bf851e0e49c83ff2a8bc2272a24448522c46a0b3198fd17eb33344/pyreproj-3.0.0.tar.gz",
"platform": null,
"description": "|build status| |coverage report|\n\nPython Reprojector\n==================\n\nThis is a simple python library for coordinate transformations between different projections. It uses the\n`pyproj library <https://github.com/jswhit/pyproj>`__ as a wrapper for `proj.4\n<https://github.com/OSGeo/proj.4>`__. The goal is to make transformations as simple as possible.\n\nUsage\n-----\n\nGet transformation function\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n from pyreproj import Reprojector\n\n rp = Reprojector()\n transform = rp.get_transformation_function(from_srs=4326, to_srs='epsg:2056')\n transform(47.46614, 7.80071)\n # returns: (2627299.6594659993, 1257325.3550428299)\n\nThe arguments *from\\_srs* and *to\\_srs* can be one of the following:\n\n- Integer: value of the EPSG code, e.g. 2056\n- String: EPSG code with leading \"epsg:\", e.g. 'epsg:2056'\n- String: proj4 definition string\n- Object: instance of pyproj.Proj\n\nThe returned function is a `functools.partial\n<https://docs.python.org/2/library/functools.html#functools.partial>`__ that can also be used as first\nargument for `shapely.ops.transform <http://toblerity.org/shapely/shapely.html#shapely.ops.transform>`__.\n\nTransform coordinates directly\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n from shapely.geometry import Point\n from pyreproj import Reprojector\n\n rp = Reprojector()\n\n p1 = Point(47.46614, 7.80071)\n p2 = rp.transform(p1, from_srs=4326, to_srs=2056)\n p2.wkt\n # returns: 'POINT (2627299.659465999 1257325.35504283)'\n\n rp.transform([47.46614, 7.80071], from_srs=4326, to_srs=2056)\n # returns: [2627299.6594659993, 1257325.3550428299]\n\n rp.transform((47.46614, 7.80071), from_srs=4326, to_srs=2056)\n # returns: (2627299.6594659993, 1257325.3550428299)\n\nThe arguments *from\\_srs* and *to\\_srs* can be one of the following:\n\n- Integer: value of the EPSG code, e.g. 2056\n- String: EPSG code with leading \"epsg:\", e.g. 'epsg:2056'\n- String: proj4 definition string\n- Object: instance of pyproj.Proj\n\nGet projection from service\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n from pyreproj import Reprojector\n\n rp = Reprojector()\n proj = rp.get_projection_from_service(epsg=2056)\n type(proj)\n # returns: <class 'pyproj.Proj'>\n\n.. |build status| image:: https://gitlab.com/geo-bl-ch/python-reprojector/badges/master/pipeline.svg\n :target: https://gitlab.com/geo-bl-ch/python-reprojector/-/commits/master\n.. |coverage report| image:: https://gitlab.com/geo-bl-ch/python-reprojector/badges/master/coverage.svg\n :target: https://gitlab.com/geo-bl-ch/python-reprojector/commits/master\n\n\nChangelog\n---------\n\n3.0.0\n~~~~~\n\nhttps://gitlab.com/geo-bl-ch/python-reprojector/milestones/3\n\n- Replace deprecated transform method\n https://pyproj4.github.io/pyproj/stable/gotchas.html#upgrading-to-pyproj-2-from-pyproj-1\n- Drop support for Pyhton 2.7, 3.5, 3.6 and 3.7\n\n2.0.0\n~~~~~\n\nhttps://gitlab.com/geo-bl-ch/python-reprojector/milestones/2\n\n- Update used version of pyproj (>=2.2.0)\n\n.. warning:: The order of lon/lat values has changed to lat/lon!\n\n1.0.1\n~~~~~\n\nhttps://gitlab.com/geo-bl-ch/python-reprojector/milestones/1\n\n- Set up deployment\n- Lock version of pyproj<2.0.0\n\n1.0.0\n~~~~~\n\n- Initial version\n- Features:\n - define projections by projection object, proj4 definition or EPSG code\n - get projection by service (e.g. http://spatialreference.org/)\n - get a transformation function from source to target projection\n - transform coordinates as list or tuple or a shapely geometry directly\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Python Reprojector",
"version": "3.0.0",
"project_urls": {
"Homepage": "https://gitlab.com/geo-bl-ch/python-reprojector"
},
"split_keywords": [
"web",
"proj",
"coordinate",
"transformation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bce3913c1f174e5e3707b0291b6f46dea4ef297600fc2fbd69182ccbd6162b3c",
"md5": "f467b04842ebcbf00e448e008e8f1b7b",
"sha256": "4f3ac8434275a6f0c5dd147136ad746f3fc5845d5590fc5659ba58711927f94b"
},
"downloads": -1,
"filename": "pyreproj-3.0.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "f467b04842ebcbf00e448e008e8f1b7b",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 5375,
"upload_time": "2023-09-28T09:34:48",
"upload_time_iso_8601": "2023-09-28T09:34:48.956814Z",
"url": "https://files.pythonhosted.org/packages/bc/e3/913c1f174e5e3707b0291b6f46dea4ef297600fc2fbd69182ccbd6162b3c/pyreproj-3.0.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d99d0221e1bf851e0e49c83ff2a8bc2272a24448522c46a0b3198fd17eb33344",
"md5": "197c7872899ec7033641e41d2c0108ec",
"sha256": "e2c065321af3d49ef5d40ced1a6c40d421fdd44d4fe824ff72f47a94a21fe96a"
},
"downloads": -1,
"filename": "pyreproj-3.0.0.tar.gz",
"has_sig": false,
"md5_digest": "197c7872899ec7033641e41d2c0108ec",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5712,
"upload_time": "2023-09-28T09:34:49",
"upload_time_iso_8601": "2023-09-28T09:34:49.983293Z",
"url": "https://files.pythonhosted.org/packages/d9/9d/0221e1bf851e0e49c83ff2a8bc2272a24448522c46a0b3198fd17eb33344/pyreproj-3.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-28 09:34:49",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "geo-bl-ch",
"gitlab_project": "python-reprojector",
"lcname": "pyreproj"
}