rio-tiler 6.2.6__py3-none-any.whl → 6.2.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
rio_tiler/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """rio-tiler."""
2
2
 
3
- __version__ = "6.2.6"
3
+ __version__ = "6.2.8"
4
4
 
5
5
  from . import ( # noqa
6
6
  colormap,
rio_tiler/colormap.py CHANGED
@@ -103,11 +103,11 @@ def apply_cmap(data: numpy.ndarray, colormap: ColorMapType) -> DataMaskType:
103
103
  if isinstance(colormap, Sequence):
104
104
  return apply_intervals_cmap(data, colormap)
105
105
 
106
- # if colormap has more than 256 values OR its `max` key >= 256 we can't use
106
+ # if colormap has less or more than 256 values OR its `max` key >= 256 we can't use
107
107
  # rio_tiler.colormap.make_lut, because we don't want to create a `lookup table`
108
108
  # with more than 256 entries (256 x 4) array. In this case we use `apply_discrete_cmap`
109
109
  # which can work with arbitrary colormap dict.
110
- if len(colormap) > 256 or max(colormap) >= 256 or min(colormap) < 0:
110
+ if len(colormap) != 256 or max(colormap) >= 256 or min(colormap) < 0:
111
111
  return apply_discrete_cmap(data, colormap)
112
112
 
113
113
  lookup_table = make_lut(colormap)
rio_tiler/utils.py CHANGED
@@ -21,7 +21,7 @@ from rasterio.vrt import WarpedVRT
21
21
  from rasterio.warp import calculate_default_transform, transform_geom
22
22
 
23
23
  from rio_tiler.colormap import apply_cmap
24
- from rio_tiler.constants import WEB_MERCATOR_CRS
24
+ from rio_tiler.constants import WEB_MERCATOR_CRS, WGS84_CRS
25
25
  from rio_tiler.errors import RioTilerError
26
26
  from rio_tiler.types import BBox, ColorMapType, IntervalTuple, RIOResampling
27
27
 
@@ -244,9 +244,38 @@ def get_vrt_transform(
244
244
 
245
245
  """
246
246
  if src_dst.crs != dst_crs:
247
+ src_width = src_dst.width
248
+ src_height = src_dst.height
249
+ src_bounds = list(src_dst.bounds)
250
+
251
+ # Fix for https://github.com/cogeotiff/rio-tiler/issues/654
252
+ #
253
+ # When using `calculate_default_transform` with dataset
254
+ # which span at high/low latitude outside the area_of_use
255
+ # of the WebMercator projection, we `crop` the dataset
256
+ # to get the transform (resolution).
257
+ #
258
+ # Note: Should be handled in gdal 3.8 directly
259
+ # https://github.com/OSGeo/gdal/pull/8775
260
+ if (
261
+ src_dst.crs == WGS84_CRS
262
+ and dst_crs == WEB_MERCATOR_CRS
263
+ and (src_bounds[1] < -85.06 or src_bounds[3] > 85.06)
264
+ ):
265
+ warnings.warn(
266
+ "Adjusting dataset latitudes to avoid re-projection overflow",
267
+ UserWarning,
268
+ )
269
+ src_bounds[1] = max(src_bounds[1], -85.06)
270
+ src_bounds[3] = min(src_bounds[3], 85.06)
271
+ w = windows.from_bounds(*src_bounds, transform=src_dst.transform)
272
+ src_height = round(w.height)
273
+ src_width = round(w.width)
274
+
247
275
  dst_transform, _, _ = calculate_default_transform(
248
- src_dst.crs, dst_crs, src_dst.width, src_dst.height, *src_dst.bounds
276
+ src_dst.crs, dst_crs, src_width, src_height, *src_bounds
249
277
  )
278
+
250
279
  else:
251
280
  dst_transform = src_dst.transform
252
281
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rio-tiler
3
- Version: 6.2.6
3
+ Version: 6.2.8
4
4
  Summary: User friendly Rasterio plugin to read raster datasets.
5
5
  Project-URL: Homepage, https://cogeotiff.github.io/rio-tiler/
6
6
  Project-URL: Documentation, https://cogeotiff.github.io/rio-tiler/
@@ -1,5 +1,5 @@
1
- rio_tiler/__init__.py,sha256=EIPvfx_D-iJ-VQWaoSO1klCMU9K3IgQ2_IPw2tSxRy4,192
2
- rio_tiler/colormap.py,sha256=J1VH8R5YuZRerHqHp6Nd-n-ovPHslMizizdgM9wsTO4,9746
1
+ rio_tiler/__init__.py,sha256=a90ZWgtx8edevsNGt8ph3jtepX8cjRxAyIvZtS3YXy8,192
2
+ rio_tiler/colormap.py,sha256=hspVEbnvbRPGPEykWxV_PoqQpltbfSR7_g35mzd1d6s,9755
3
3
  rio_tiler/constants.py,sha256=55i-7JZDupTXZdLgxL03KsgM4lAzuGuIVP1zZKktzp0,426
4
4
  rio_tiler/errors.py,sha256=ag-wNr13JaQ4YcQzWWPFzjegeGdzJIMMrOrbb3coQ40,1733
5
5
  rio_tiler/expression.py,sha256=EVHWgjMqIn4TTPfqT_HV1RWCQlxqOj3OtEr1iUDiFHE,2282
@@ -10,7 +10,7 @@ rio_tiler/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  rio_tiler/reader.py,sha256=fdnqHVGTP7MXocs8l9zojvbHMtgmdKThsWLbMu5-j3g,20996
11
11
  rio_tiler/tasks.py,sha256=O4laTCr66XHJ-4REWg3SAaA1pre0OMG0NklbKZ2g9Fc,3181
12
12
  rio_tiler/types.py,sha256=508_E5R-nKrAo8TWB-6h7pF6SYwNM8kJPiHjQw-k-tA,1443
13
- rio_tiler/utils.py,sha256=7G6FXmP-FdCKi5Gs6K9iSQcIUffn4tRjZISxXfOyGwY,22483
13
+ rio_tiler/utils.py,sha256=gxIgDEwZT9PQckBkK5bde5pqczH_CpKPCPWwTph_0fA,23615
14
14
  rio_tiler/cmap_data/__init__.py,sha256=8FtVmfpTjXlvhxQ5QesN0UC1m_B3MuF3LbGbhMC5Rw4,1039
15
15
  rio_tiler/cmap_data/accent.npy,sha256=Qde1ldOoXghe4L05v1QbVvnMA1ldwNjKWPf5xCBbmI4,1152
16
16
  rio_tiler/cmap_data/accent_r.npy,sha256=ba-GWSMSPRAcm9CGzlXJeNG4ABbBHDCV602hAWV2idc,1152
@@ -233,8 +233,8 @@ rio_tiler/mosaic/reader.py,sha256=_YBwTJwHvXOzKwpNpOmmh0F4yicyxgWo9vHyof3w_Do,96
233
233
  rio_tiler/mosaic/methods/__init__.py,sha256=Q_jS2CwdFPP3ylJ78sUv41bc12hxrdlLC-Q4HSifP1U,571
234
234
  rio_tiler/mosaic/methods/base.py,sha256=9YZJWVRwH5Fk9KO9q5CW52Q8Mf60tAJ21oM4ixEDXBo,1424
235
235
  rio_tiler/mosaic/methods/defaults.py,sha256=foCdit5qE77IYefLWer0f-vI45tHBZRI5PqIZEYim-g,5744
236
- rio_tiler-6.2.6.dist-info/METADATA,sha256=VKZUU4hU11FkFWgluphAV2zDvFZ8VLjufa-Z5thYq1U,11869
237
- rio_tiler-6.2.6.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
238
- rio_tiler-6.2.6.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
239
- rio_tiler-6.2.6.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
240
- rio_tiler-6.2.6.dist-info/RECORD,,
236
+ rio_tiler-6.2.8.dist-info/METADATA,sha256=AVMFAm8dTfM1CIfYbs_5WEnaJOCX_AWXti7phIjp3eo,11869
237
+ rio_tiler-6.2.8.dist-info/WHEEL,sha256=Gw8jIuTWkPakxikG-6o91zOxTjpZNZ00Qw8KZLqAprY,87
238
+ rio_tiler-6.2.8.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
239
+ rio_tiler-6.2.8.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
240
+ rio_tiler-6.2.8.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.18.0
2
+ Generator: hatchling 1.19.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any