cogeotiff/rio-tiler

Method to filter assets within mosaic_reader

sor-droneup opened this issue · 1 comments

Hello,

I've noticed that for some mosaic the mosaic_reader function download some geotiffs before pixel selection, even if those geotiffs does not intersect with the tile (this happens in case if mosaic was generated with low zoom level).

A simple filter method could be added that would check if geotiff boundaries intersects with a tile before loading it, that would greatly reduce the execution time in scenarios like above.

Has this been considered before ? Is there any reason why there is no such filtering?

Such logics could be added for example in line 78 here:

def mosaic_reader( # noqa: C901

if the geotiff does not intersect with the tile, a TileOutsideBounds https://github.com/cogeotiff/rio-tiler/blob/main/rio_tiler/io/rasterio.py#L348-L351 should be raised. But in all the case, this will imply that the COG header will be downloaded and the COG dataset opened.

could you maybe explain a bit more and share a reproducible example 🙏