rio-tiler 6.4.7__py3-none-any.whl → 6.5.0__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.4.7"
3
+ __version__ = "6.5.0"
4
4
 
5
5
  from . import ( # noqa
6
6
  colormap,
rio_tiler/reader.py CHANGED
@@ -366,6 +366,8 @@ def part(
366
366
  vrt_transform, vrt_width, vrt_height = get_vrt_transform(
367
367
  src_dst,
368
368
  bounds,
369
+ height,
370
+ width,
369
371
  dst_crs=dst_crs,
370
372
  align_bounds_with_dataset=align_bounds_with_dataset,
371
373
  )
@@ -384,6 +386,8 @@ def part(
384
386
  vrt_transform, vrt_width, vrt_height = get_vrt_transform(
385
387
  src_dst,
386
388
  bounds,
389
+ height,
390
+ width,
387
391
  dst_crs=dst_crs,
388
392
  align_bounds_with_dataset=align_bounds_with_dataset,
389
393
  )
rio_tiler/utils.py CHANGED
@@ -296,8 +296,8 @@ def get_vrt_transform(
296
296
  Args:
297
297
  src_dst (rasterio.io.DatasetReader or rasterio.io.DatasetWriter or rasterio.vrt.WarpedVRT): Rasterio dataset.
298
298
  bounds (tuple): Bounding box coordinates in target crs (**dst_crs**).
299
- height (int, optional): Desired output height of the array for the input bounds.
300
- width (int, optional): Desired output width of the array for the input bounds.
299
+ height (int, optional): Output height of the array for the input bounds.
300
+ width (int, optional): Output width of the array for the input bounds.
301
301
  dst_crs (rasterio.crs.CRS, optional): Target Coordinate Reference System. Defaults to `epsg:3857`.
302
302
  align_bounds_with_dataset (bool): Align input bounds with dataset transform. Defaults to `False`.
303
303
 
@@ -384,31 +384,35 @@ def get_vrt_transform(
384
384
 
385
385
  w, s, e, n = bounds
386
386
 
387
- # TODO: Explain
388
- if not height or not width:
389
- vrt_width = max(1, round((e - w) / dst_transform.a))
390
- vrt_height = max(1, round((s - n) / dst_transform.e))
391
- vrt_transform = from_bounds(w, s, e, n, vrt_width, vrt_height)
392
- return vrt_transform, vrt_width, vrt_height
393
-
394
- # TODO: Explain
395
- tile_transform = from_bounds(w, s, e, n, width, height)
396
- w_res = (
397
- tile_transform.a
398
- if abs(tile_transform.a) < abs(dst_transform.a)
399
- else dst_transform.a
400
- )
401
- h_res = (
402
- tile_transform.e
403
- if abs(tile_transform.e) < abs(dst_transform.e)
404
- else dst_transform.e
405
- )
387
+ # When no output size (resolution) - Use Dataset Resolution
388
+ # NOTE: When we don't `fix` the output width/height, we're using the reprojected dataset resolution
389
+ # to calculate what is the size/transform of the VRT
390
+ w_res = dst_transform.a
391
+ h_res = dst_transform.e
392
+
393
+ # NOTE: When we have desired output height/width, we can use them to
394
+ # calculate the output size/transform. The VRT resolution will be aligned with the desired
395
+ # output resolution (if not bigger)
396
+ if height and width:
397
+ output_transform = from_bounds(w, s, e, n, width, height)
398
+
399
+ # NOTE: Here we check if the Output Resolution is higher thant the dataset resolution (OverZoom)
400
+ # When not overzooming we don't want to use the output Width/Height to calculate the transform
401
+ # See issues https://github.com/cogeotiff/rio-tiler/pull/648
402
+ w_res = (
403
+ output_transform.a
404
+ if abs(output_transform.a) < abs(dst_transform.a)
405
+ else dst_transform.a
406
+ )
407
+ h_res = (
408
+ output_transform.e
409
+ if abs(output_transform.e) < abs(dst_transform.e)
410
+ else dst_transform.e
411
+ )
406
412
 
407
- # TODO: Explain
408
413
  vrt_width = max(1, round((e - w) / w_res))
409
414
  vrt_height = max(1, round((s - n) / h_res))
410
415
  vrt_transform = from_bounds(w, s, e, n, vrt_width, vrt_height)
411
-
412
416
  return vrt_transform, vrt_width, vrt_height
413
417
 
414
418
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rio-tiler
3
- Version: 6.4.7
3
+ Version: 6.5.0
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,4 +1,4 @@
1
- rio_tiler/__init__.py,sha256=vHddqRd_9wVkQaEb950PsIvnUUDBxfLLiDKLLnMEB80,192
1
+ rio_tiler/__init__.py,sha256=SZiCYKyXS14zb5BZaGMXyw54dmXhNThkbH3vsF9fLRs,192
2
2
  rio_tiler/colormap.py,sha256=uXeK2p-h6fMqTaCogHWkDP6AqJDtKCpCHa5ylRdEnj0,9775
3
3
  rio_tiler/constants.py,sha256=55i-7JZDupTXZdLgxL03KsgM4lAzuGuIVP1zZKktzp0,426
4
4
  rio_tiler/errors.py,sha256=ag-wNr13JaQ4YcQzWWPFzjegeGdzJIMMrOrbb3coQ40,1733
@@ -7,10 +7,10 @@ rio_tiler/logger.py,sha256=RR8lnW3uVXkFkPa3nNJS_tTndmdiNNDVXpCDGDxGf0A,81
7
7
  rio_tiler/models.py,sha256=TlJ0VoZVIzeMDTzdGIxmBKutLcMpxRAAdrcWg63T5Ts,28149
8
8
  rio_tiler/profiles.py,sha256=EAx2JdcaOcMw5PZjxbCqQBXXWMac9mjtpHoVFPJEDNQ,1562
9
9
  rio_tiler/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- rio_tiler/reader.py,sha256=t8iMYYjfKKGvtSH7ljUdbmdilbTC50_98PwtTrFC7Ek,21841
10
+ rio_tiler/reader.py,sha256=DHI-YO0nVmTcz_BfPLUb-ZsRFMQzU1vHJOvnsTR4m2M,21927
11
11
  rio_tiler/tasks.py,sha256=tiQo24rZHBVxids40QkNInuMzDFEei08zYW3I_pkSVE,3157
12
12
  rio_tiler/types.py,sha256=508_E5R-nKrAo8TWB-6h7pF6SYwNM8kJPiHjQw-k-tA,1443
13
- rio_tiler/utils.py,sha256=ZbOG2eCHBY5gx82LcqLQzPMOy0kQ4Mimy1aA_6w0dAE,27257
13
+ rio_tiler/utils.py,sha256=3TBlnQVFA-2igDpMrwxhjN_Quvc8t21xv7sQkM7e6dQ,27748
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=tgkXM9skaTLXIm5QFoheOEznQXM97KGflcAWHfkrt1g,612
234
234
  rio_tiler/mosaic/methods/base.py,sha256=9YZJWVRwH5Fk9KO9q5CW52Q8Mf60tAJ21oM4ixEDXBo,1424
235
235
  rio_tiler/mosaic/methods/defaults.py,sha256=z34lna2wGXnAPwculjk_6hDrloqS8wzer68FFoIo7pg,6744
236
- rio_tiler-6.4.7.dist-info/METADATA,sha256=4SBddP6XLK-3pFOJGuxuW0gCfemnF-upGM-1mYXR8As,11920
237
- rio_tiler-6.4.7.dist-info/WHEEL,sha256=osohxoshIHTFJFVPhsi1UkZuLRGMHRXZzwEBW2ezjrc,87
238
- rio_tiler-6.4.7.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
239
- rio_tiler-6.4.7.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
240
- rio_tiler-6.4.7.dist-info/RECORD,,
236
+ rio_tiler-6.5.0.dist-info/METADATA,sha256=JYqf9bgGl8imf7grKE0luuceUrC03-GYySyfvV0SWDA,11920
237
+ rio_tiler-6.5.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
238
+ rio_tiler-6.5.0.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
239
+ rio_tiler-6.5.0.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
240
+ rio_tiler-6.5.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.24.1
2
+ Generator: hatchling 1.24.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any