Commit c9e62798 authored by Daniel Scheffler's avatar Daniel Scheffler

Merge branch 'master' into bugfix/fix_ci_connection

# Conflicts:
#	.gitlab-ci.yml
#	HISTORY.rst
#	py_tools_ds/version.py
parents d0bcfd00 0117d611
Pipeline #12220 passed with stage
in 21 seconds
......@@ -2,7 +2,7 @@
History
=======
0.15.3 (2020-09-02)
0.15.5 (2020-09-02)
-------------------
* Revised build_testsuite_image.sh
......@@ -10,6 +10,19 @@ History
* Added some comments to build_testsuite_image.sh and set concurrency to 4. Updated deprecated code in .gitlab_ci.yml.
0.15.4 (2020-09-01)
-------------------
* Fixed wrong output of reproject_shapelyGeometry() in case of EPSG 4326.
0.15.3 (2020-09-01)
-------------------
* Fixed wrong output of transform_any_prj() in case of EPSG 4326.
* Updated minimal version of pyproj to 2.2.0.
0.15.2 (2020-08-27)
-------------------
......
......@@ -70,7 +70,8 @@ def transform_any_prj(prj_src, prj_tgt, x, y):
:return:
"""
transformer = pyproj.Transformer.from_crs(pyproj.CRS.from_user_input(prj_src),
pyproj.CRS.from_user_input(prj_tgt))
pyproj.CRS.from_user_input(prj_tgt),
always_xy=True)
return transformer.transform(x, y)
......@@ -304,6 +305,7 @@ def reproject_shapelyGeometry(shapelyGeometry, prj_src, prj_tgt):
"""
project = pyproj.Transformer.from_proj(
pyproj.CRS.from_user_input(prj_src),
pyproj.CRS.from_user_input(prj_tgt))
pyproj.CRS.from_user_input(prj_tgt),
always_xy=True)
return transform(project.transform, shapelyGeometry) # apply projection
......@@ -37,7 +37,7 @@ with open("py_tools_ds/version.py") as version_file:
exec(version_file.read(), version)
requirements = ['gdal>=2.1.0', 'numpy', 'shapely', 'six', 'pandas', 'scikit-image>=0.16.0', 'geopandas',
'pyproj>=2.1.0', 'spectral']
'pyproj>=2.2.0', 'spectral']
setup_requirements = [] # TODO(danschef): put setup requirements (distutils extensions, etc.) here
test_requirements = requirements + ["coverage", "nose", "nose2", "nose-htmloutput", "rednose"]
......
......@@ -8,7 +8,7 @@ dependencies:
- pip # avoids that conda uses the wrong pip
- numpy
- gdal>=2.1.0
- pyproj>=2.1.0
- pyproj>=2.2.0
- scikit-image>=0.16.0
- geopandas
- pip:
......
......@@ -30,17 +30,29 @@ test_coord_trafo
Tests for `py_tools_ds.geo.coord_trafo` module.
"""
import unittest
from unittest import TestCase
from shapely.geometry import Polygon
from py_tools_ds.geo.coord_trafo import reproject_shapelyGeometry
from py_tools_ds.geo.coord_trafo import reproject_shapelyGeometry, transform_any_prj
poly_local = Polygon([(5708.2, -3006), (5708, -3262), (5452, -3262), (5452, -3006), (5708, -3006)])
ll_x, ll_y = (10.701359, 47.54536)
utm_x, utm_y = (628023.1302739962, 5267173.503313034)
class Test_reproject_shapelyGeometry(unittest.TestCase):
class Test_reproject_shapelyGeometry(TestCase):
def test_reproject_shapelyGeometry(self):
poly_lonlat = reproject_shapelyGeometry(poly_local, 32636, 4326)
self.assertTrue(isinstance(poly_lonlat, Polygon))
class Test_transform_any_prj(TestCase):
def test_lonlat_to_utm(self):
out_x, out_y = transform_any_prj(4326, 32632, ll_x, ll_y)
self.assertTrue(isinstance(out_x, float))
self.assertTrue(isinstance(out_y, float))
self.assertEqual((out_x, out_y), (utm_x, utm_y))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment