Re: Does rasterio.warp.reproject use overviews?

Sean Gillies


1. Correct. To use overviews, you must pass a dataset explicitly opened on an overview using `"example.tif", OVERVIEW_LEVEL=1)`.
2. Correct again. We'll add an option to use an automatically determined source file overview, as gdalwarp does.

On Thu, Nov 5, 2020 at 10:29 AM Loïc Dutrieux <loic.dutrieux@...> wrote:

Hi Sean,

Thank you for your response.

Is it correct to interpret from your explanation that:

 1- currently the reproject function will never use overviews of the source file, even when it involves downsampling.

 2- In a future version `reproject()` will eventually use source file overviews. (and the user will be able to control that behavior via an argument (e.g. overviewLevel= as in gdal python API)?)

To provide some context about why I want to know that, I'm warping 10 m sentinel2 data to a 20 m grid and I want to make sure it does *not* use the source file overviews. Overviews are fine for visualization but often not suitable for analysis (unless they have been generated with the right resampling algorithm).

Thanks again,



From: <> on behalf of Sean Gillies <sean.gillies@...>
Sent: 05 November 2020 16:27:12
Subject: Re: [rasterio] Does rasterio.warp.reproject use overviews?
Hi Loïc,

On Tue, Nov 3, 2020 at 8:55 AM Loïc Dutrieux <loic.dutrieux@...> wrote:

Hi everyone,

I read that the gdalwarp command line defaults to using the overview level nearest to target resolution. What about `rasterio.warp.reproject()`? Does it use overview at all?

Thank you and kind regards,


gdalwarp's logic is found in apps/gdalwarp_lib.cpp, not in gcore, so rasterio.warp.reproject() does not have it. We've got a rasterio ticket about switching over to use the main function in apps/gdalwarp_lib.cpp so that the behavior of rasterio.warp.reproject() is exactly the same as gdalwarp, but haven't started work on it yet.

Sean Gillies

Sean Gillies

Join to automatically receive all group messages.