Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable transformation if source CRS equals to destination #270

Merged
merged 2 commits into from
Jun 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
'packaging',
'pycodestyle',
'pytest>=4',
'pytest-cov',
'pytest-cov<=2.8.1',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What problems does the new version have?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'sphinx',
'ipython',
'nbsphinx',
Expand Down
2 changes: 1 addition & 1 deletion telluric/util/local_tile_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _get_raster_png_tile(self, raster, x, y, z):

@gen.coroutine
def _get_collection_png_tile(self, fc, x, y, z):
rasters = yield gen.multi([self._get_raster_png_tile(f.raster(), x, y, z) for f in fc])
rasters = yield gen.multi([self._get_raster_png_tile(f.raster(), x, y, z) for f in fc]) # type: ignore
if len(rasters) < 1:
return None
tile = yield self._merge_rasters(rasters, z)
Expand Down
3 changes: 2 additions & 1 deletion telluric/util/projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def transform(shape, source_crs, destination_crs=None, src_affine=None, dst_affi
if src_affine is not None:
shape = ops.transform(lambda r, q: ~src_affine * (r, q), shape)

shape = generate_transform(source_crs, destination_crs)(shape)
if source_crs != destination_crs:
shape = generate_transform(source_crs, destination_crs)(shape)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


if dst_affine is not None:
shape = ops.transform(lambda r, q: dst_affine * (r, q), shape)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_geovector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import tempfile

import pytest
import shapely
from packaging import version
from unittest import mock
from numpy.testing import assert_array_almost_equal
from pytest import approx
Expand Down Expand Up @@ -515,6 +517,10 @@ def test_polygonize_line():
assert result == expected_result


@pytest.mark.skipif(
version.parse(shapely.__version__) >= version.parse('1.7b1'),
reason="Shapely < 1.7b1 is required",
)
drnextgis marked this conversation as resolved.
Show resolved Hide resolved
def test_polygonize_line_square_cap_style():
diag = 1 / math.sqrt(2)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_vrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pyproj
import rasterio
import numpy as np
from distutils.version import LooseVersion as V
from packaging import version
from rasterio.io import MemoryFile
from tempfile import NamedTemporaryFile, TemporaryDirectory
from telluric.util.raster_utils import build_vrt
Expand Down Expand Up @@ -46,7 +46,7 @@


@pytest.mark.skipif(
V(pyproj.__version__) < V('2.0.0'),
version.parse(pyproj.__version__) < version.parse('2.0.0'),
reason="pyproj >= 2 is required",
)
def test_wms_vrt():
Expand Down