Skip to content

Commit

Permalink
Disable transformation if source CRS equals to destination
Browse files Browse the repository at this point in the history
  • Loading branch information
drnextgis committed Jun 27, 2020
1 parent 19b6e4f commit 7ea41e3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
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',
'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)

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.7a3'),
reason="Shapely < 1.7a3 is required",
)
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

0 comments on commit 7ea41e3

Please sign in to comment.