<div><div dir="auto">Hey Even,</div><div dir="auto"><br></div><div dir="auto">Yes I guess ;)</div><div dir="auto"><br></div><div dir="auto">However, what you say is exactly what I did and what I had hoped but I found that it was reading only the first 512x512 pixels of my big raster and dumping at full res rather than downsampling it as I expected!</div></div><div dir="auto">I expected so much the behavior you mention so much that it took me time to understand what was actually happening!</div><div dir="auto"><br></div><div dir="auto">Maybe I did something wrong then. I’ll retry again</div><div dir="auto"><br></div><div><div dir="auto">Thanks for the quick answer as always</div><div dir="auto">Greg</div><br><div class="gmail_quote"><div>On Tue, 12 Jun 2018 at 16:42, Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On mardi 12 juin 2018 16:20:47 CEST Grégory Bataille wrote:<br>
> Hello everyone,<br>
> <br>
> I’m trying to migrate my code to COG more and more rather than<br>
> pre-computing some views/data.<br>
> <br>
> I have had some great success with extracting partial full res raster<br>
> values and it’s great.<br>
> <br>
> One thing I have not been able to do so far though is « reading from the<br>
> overview »<br>
> Say for example I want to render a 512x512 tiles of data but really zoomed<br>
> out. Let’s say for example that this tile contains my entire 10’000x10’000<br>
> pixels geotiff. It’s obviously super inefficient to read from the raw<br>
> raster rather than reading from one of the pre-computed overviews.<br>
> Is there an API (python) to ask for raster data (between 2 points) (like<br>
> ReadAsArray which is the one I currently use) but passing it the output<br>
> size so that gdal can figure out which overview it’s better to read from?<br>
> <br>
<br>
Grégory,<br>
<br>
This is a GDAL question in fact :-)<br>
<br>
Yes, the full signature of Dataset.ReadAsArray() is<br>
<br>
    def ReadAsArray(self, xoff=0, yoff=0, xsize=None, ysize=None,<br>
                    buf_obj=None,<br>
                    buf_xsize=None, buf_ysize=None, buf_type=None,<br>
                    resample_alg=gdalconst.GRIORA_NearestNeighbour,<br>
                    callback=None,<br>
                    callback_data=None,<br>
                    interleave='band'):<br>
<br>
<br>
So specify buf_xsize and buf_ysize (or pass a buf_obj of the appropriate <br>
output size)<br>
<br>
Even<br>
<br>
-- <br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
<br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Greg</div>