rio-tiler: Can't read `part` with intersecting bounds

reported in https://github.com/developmentseed/titiler/discussions/640#discussioncomment-10636946

I'm getting that error consistently with the following url:

https://{something}/cog/bbox/-72.39661926483915,-14.198810143003932,-72.26331881334586,-14.066961918019524/595x842.tif?url=https://{something}/mantis/l1c/2024/08/03/MANTIS_L1C_021900730139_20240803T151319_20240803T151321/TCI_COG.tiff

I've tried several things:
- Adjusting bbox values
- Not adding bbox
- Using query parameters (such as zoom, max_size, nodata, etc)

Nothings seems to be working.

The info endpoint returns the following:

Driver: GTiff/GeoTIFF
Files: mantis.tif
Size is 7532, 7428
Coordinate System is:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
GeoTransform =
  -72.39661926483915, 1.523991680507554e-05, 2.492379929651992e-06
  -14.16868824977417, -3.999189223282901e-06, 1.369498273487359e-05
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=PIXEL
  LAYOUT=COG
Corner Coordinates:
Upper Left  ( -72.3966193, -14.1686882) ( 72d23'47.83"W, 14d10' 7.28"S)
Lower Left  ( -72.3781059, -14.0669619) ( 72d22'41.18"W, 14d 4' 1.06"S)
Upper Right ( -72.2818322, -14.1988101) ( 72d16'54.60"W, 14d11'55.72"S)
Lower Right ( -72.2633188, -14.0970838) ( 72d15'47.95"W, 14d 5'49.50"S)
Center      ( -72.3299690, -14.1328860) ( 72d19'47.89"W, 14d 7'58.39"S)
Band 1 Block=512x512 Type=Byte, ColorInterp=Undefined
  NoData Value=0
  Overviews: 3766x3714, 1883x1857, 941x928, 470x464
Band 2 Block=512x512 Type=Byte, ColorInterp=Undefined
  NoData Value=0
  Overviews: 3766x3714, 1883x1857, 941x928, 470x464
Band 3 Block=512x512 Type=Byte, ColorInterp=Undefined
  NoData Value=0
  Overviews: 3766x3714, 1883x1857, 941x928, 470x464
  
  The bounds endpoint returns the following:
  
  {'bounds': [-72.39661926483915, -14.198810143003932, -72.26331881334586, -14.066961918019524]}
  
  The statistics endpoint returns the following:
  
  {'b1': {'min': 2.0, 'max': 255.0, 'mean': 120.4366812365454, 'count': 946702.0, 'sum': 114017647.0, 'std': 37.32024805775883, 'median': 121.0, 'majority': 121.0, 'minority': 2.0, 'unique': 254.0, 'histogram': [[6759.0, 25467.0, 83966.0, 184967.0, 259873.0, 216997.0, 111765.0, 41689.0, 13035.0, 2184.0], [2.0, 27.3, 52.6, 77.9, 103.2, 128.5, 153.8, 179.1, 204.4, 229.70000000000002, 255.0]], 'valid_percent': 91.54, 'masked_pixels': 87538.0, 'valid_pixels': 946702.0, 'percentile_2': 44.0, 'percentile_98': 201.0}, 'b2': {'min': 1.0, 'max': 255.0, 'mean': 111.99736559128426, 'count': 946702.0, 'sum': 106028130.0, 'std': 34.50480622081493, 'median': 113.0, 'majority': 118.0, 'minority': 1.0, 'unique': 255.0, 'histogram': [[7252.0, 31979.0, 112193.0, 207180.0, 284018.0, 204372.0, 72250.0, 21912.0, 4764.0, 782.0], [1.0, 26.4, 51.8, 77.19999999999999, 102.6, 128.0, 153.39999999999998, 178.79999999999998, 204.2, 229.6, 255.0]], 'valid_percent': 91.54, 'masked_pixels': 87538.0, 'valid_pixels': 946702.0, 'percentile_2': 40.0, 'percentile_98': 185.0}, 'b3': {'min': 1.0, 'max': 255.0, 'mean': 107.7169785212242, 'count': 946702.0, 'sum': 101975879.0, 'std': 32.5602988773908, 'median': 109.0, 'majority': 115.0, 'minority': 247.0, 'unique': 255.0, 'histogram': [[8383.0, 36193.0, 122873.0, 228991.0, 295296.0, 189146.0, 51156.0, 12027.0, 2297.0, 340.0], [1.0, 26.4, 51.8, 77.19999999999999, 102.6, 128.0, 153.39999999999998, 178.79999999999998, 204.2, 229.6, 255.0]], 'valid_percent': 91.54, 'masked_pixels': 87538.0, 'valid_pixels': 946702.0, 'percentile_2': 38.0, 'percentile_98': 174.0}}
  
  The preview endpoint works fine!
  

Any idea of what might be happening?

ps - If I use only the last part of the url (https://{something}/mantis/l1c/2024/08/03/MANTIS_L1C_021900730139_20240803T151319_20240803T151321/TCI_COG.tiff) the image is properly downloaded

Thank you in advance :)

_Originally posted by @MisterTiago in https://github.com/developmentseed/titiler/discussions/640#discussioncomment-10636946_

Issue: User is trying to read bbox with bounds intersecting the database bounds (boundless read)

Solutions:

  • user WarpedVRT
  • customize the windows.from_bounds method from rasterio to avoid causing issue

cc @MisterTiago

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Hi @vincentsarago,

Just want to let you know that I’ve applied the command gdalwarp -t_srs EPSG:4326 -of COG \<input\> \<output\> and my action now works with the output image.

HI @vincentsarago ,

Apologies for taking so long to reply, been caught on other issues.

Regarding the transform, we use a simple pinhole camera model which generates GCPs for the 4 corners from which the affine is made.

Does this answer your question?

Do you want to know how the transform is being calculated for this image?