Commit c844f704 authored by Daniel Scheffler's avatar Daniel Scheffler

Fixed wrong output of transform_any_prj() in case of EPSG 4326. Updated...

Fixed wrong output of transform_any_prj() in case of EPSG 4326. Updated minimal version of pyproj to 2.2.0.
Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 75b7bd30
Pipeline #12129 failed with stages
in 18 minutes and 57 seconds
......@@ -24,7 +24,7 @@ test_py_tools_ds:
- source activate ci_env
- export GDAL_DATA=/root/miniconda3/envs/ci_env/share/gdal
- export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later
- conda install -c conda-forge 'pyproj>=2.1' # FIXME remove as soon as docker container is rebuilt
- conda install -c conda-forge 'pyproj>=2.2' # FIXME remove as soon as docker container is rebuilt
- make nosetests
- make docs
artifacts:
......
......@@ -2,6 +2,13 @@
History
=======
0.15.3 (2020-09-21)
-------------------
* 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)
......
......@@ -19,5 +19,5 @@
# You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '0.15.2'
__versionalias__ = '20200827_02'
__version__ = '0.15.3'
__versionalias__ = '20200901_01'
......@@ -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