<div dir="ltr"><font face="monospace">ds_img.FlushCache()</font> did the trick!<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 5, 2022 at 4:44 PM Denis Rykov <<a href="mailto:rykovd@gmail.com">rykovd@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I would expect these 2 ways of running GDAL warp should produce the same results.</div><div><br></div><div><font face="monospace">gdalwarp -t_srs EPSG:3857 \<br>         -te 558728 5789851 1242296 7544030 \<br>         -ts 500 500 \<br>         "WMS:<a href="http://127.0.0.1:8080/api/resource/5840/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=test_rounds&SRS=EPSG:4326&BBOX=-180.000000,-85.051129,180.000000,85.051129" target="_blank">http://127.0.0.1:8080/api/resource/5840/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=test_rounds&SRS=EPSG:4326&BBOX=-180.000000,-85.051129,180.000000,85.051129</a>" \<br>         /tmp/result1.tif</font><br></div><div><font face="monospace"><br></font></div><div><font face="monospace">and</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">from osgeo import gdal<br>from osgeo import gdalconst<br><br>width = height = 500<br>url = "WMS:<a href="http://127.0.0.1:8080/api/resource/5840/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=test_rounds&SRS=EPSG:4326&BBOX=-180.000000,-85.051129,180.000000,85.051129" target="_blank">http://127.0.0.1:8080/api/resource/5840/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=test_rounds&SRS=EPSG:4326&BBOX=-180.000000,-85.051129,180.000000,85.051129</a>"<br>ds = gdal.Open(url, gdalconst.GA_ReadOnly)<br>ds_img = gdal.Warp(<br>    "/tmp/result2.tif",<br>    ds,<br>    options=gdal.WarpOptions(<br>        width=width,<br>        height=height,<br>        outputBounds=(558728, 5789851, 1242296, 7544030),<br>        dstSRS="EPSG:3857",<br>    ),<br>)<br></font></div><div><font face="monospace"><br></font></div><div><font face="monospace">But in the first case I get what I expect but in the second one I get a raster with right spatial extent but 0 in all bands.</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">What am I missing?</font></div></div>
</blockquote></div>