<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Filed as <a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/issues/10174">https://github.com/OSGeo/gdal/issues/10174</a><br>
</p>
<div class="moz-cite-prefix">Le 10/06/2024 à 10:57, Denis Rykov via
gdal-dev a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAJbvKNqeL56OkPMjas0Rb068XfoYGvP6TAx4smzin0xs6SDNiA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Thank you, Jukka, for reproducing the behavior and
explaining the reason behind it!</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Jun 10, 2024 at
9:19 AM Rahkonen Jukka <<a
href="mailto:jukka.rahkonen@maanmittauslaitos.fi"
moz-do-not-send="true" class="moz-txt-link-freetext">jukka.rahkonen@maanmittauslaitos.fi</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 class="msg-3094747861169699419">
<div style="overflow-wrap: break-word;" lang="FI">
<div class="m_-3094747861169699419WordSection1">
<p class="MsoNormal"><span>Hi,</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span lang="EN-US">Those two
commands behave in quite different ways. With “-oo
OVERVIEW_LEVEL=1” the output size is the size of the
second overview. In my test case the original has
12000 x 12000 pixels and the command creates a 3000
x 3000 sized output</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL:
GDALOverviewDataset(vrttest.vrt,
this=000001CB3D728890) creation.</span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL: Using
GTiff driver</span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL: Computing
area of interest: 26.8805, 63.2011, 27, 63.255</span></p>
<p class="MsoNormal"><span lang="EN-US">Creating output
file that is 3000P x 3000L.</span></p>
<p class="MsoNormal"><span lang="EN-US">…</span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL:
GDALWarpKernel()::GWKNearestNoMasksOrDstDensityOnlyByte()
Src=0,0,3000x3000 Dst=0,0,3000x3000</span></p>
<p class="MsoNormal"><span lang="EN-US">...10...20...30...40...50...60...70...80...90...100
- done.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">With -ovr 1 the
output has the size of the full resolution image,
12000 x 12000 pixels, even the data is read from the
3000 x 3000 overview. The pixels will be upsampled.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL: Using
GTiff driver</span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL: Computing
area of interest: 26.8805, 63.2011, 27, 63.255</span></p>
<p class="MsoNormal"><span lang="EN-US">Creating output
file that is 12000P x 12000L.</span></p>
<p class="MsoNormal"><span lang="EN-US">WARP: Selecting
overview level 1 for vrttest.vrt</span></p>
<p class="MsoNormal"><span lang="EN-US">…</span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL:
GDALWarpKernel()::GWKNearestNoMasksOrDstDensityOnlyByte()
Src=0,0,1500x750 Dst=0,0,6000x3000</span></p>
<p class="MsoNormal"><span lang="EN-US">...10.GDAL:
GDALWarpKernel()::GWKNearestNoMasksOrDstDensityOnlyByte()
Src=1500,0,1500x750 Dst=6000,0,6000x3000</span></p>
<p class="MsoNormal"><span lang="EN-US">..20..GDAL:
GDALWarpKernel()::GWKNearestNoMasksOrDstDensityOnlyByte()
Src=0,750,1500x750 Dst=0,3000,6000x3000</span></p>
<p class="MsoNormal"><span lang="EN-US">.30...GDAL:
GDALWarpKernel()::GWKNearestNoMasksOrDstDensityOnlyByte()
Src=1500,750,1500x750 Dst=6000,3000,6000x3000</span></p>
<p class="MsoNormal"><span lang="EN-US">40...50GDAL:
GDALWarpKernel()::GWKNearestNoMasksOrDstDensityOnlyByte()
Src=0,1500,1500x750 Dst=0,6000,6000x3000</span></p>
<p class="MsoNormal"><span lang="EN-US">...60.GDAL:
GDALWarpKernel()::GWKNearestNoMasksOrDstDensityOnlyByte()
Src=1500,1500,1500x750 Dst=6000,6000,6000x3000</span></p>
<p class="MsoNormal"><span lang="EN-US">..70..GDAL:
GDALWarpKernel()::GWKNearestNoMasksOrDstDensityOnlyByte()
Src=0,2250,1500x750 Dst=0,9000,6000x3000</span></p>
<p class="MsoNormal"><span lang="EN-US">.80...GDAL:
GDALWarpKernel()::GWKNearestNoMasksOrDstDensityOnlyByte()
Src=1500,2250,1500x750 Dst=6000,9000,6000x3000</span></p>
<p class="MsoNormal"><span lang="EN-US">90...100 - done.</span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL: Flushing
dirty blocks:
0...10...20...30...40...50...60...70...80...90...100
- done.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">The behavior is
the same when using a TIFF with internal overviews
as input instead of VRT. Obviously the -ovr option
has been designed to force the use of some
better-quality overview as source data when warping
yields a smaller, downsampled image. The forced
upsampling does not make much sense to me. I wonder
if gdalwarp should even allow that?</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">The
gdal_translate utility has also -ovr option
<a
href="https://gdal.org/programs/gdal_translate.html#cmdoption-gdal_translate-ovr"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">
https://gdal.org/programs/gdal_translate.html#cmdoption-gdal_translate-ovr</a>.
It behaves in a different way when it comes to the
size of the output, but with gdal_translate it makes
sense.</span></p>
<p class="MsoNormal"><span lang="EN-US">“When -ovr is
specified to an integer value, and none of -outsize
and -tr is specified, the size of the overview will
be used as the output size.”</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Maybe the thing
to do is to improve the documentation of the
gdalwarp option
<a
href="https://gdal.org/programs/gdalwarp.html#cmdoption-gdalwarp-ovr"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://gdal.org/programs/gdalwarp.html#cmdoption-gdalwarp-ovr</a>
and mention that this option does not have on effect
on the size of the output.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">-Jukka Rahkonen-</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<div
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b>Lähettäjä:</b> gdal-dev <<a
href="mailto:gdal-dev-bounces@lists.osgeo.org"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">gdal-dev-bounces@lists.osgeo.org</a>>
<b>Puolesta </b>Denis Rykov via gdal-dev<br>
<b>Lähetetty:</b> maanantai 10. kesäkuuta 2024 2.27<br>
<b>Vastaanottaja:</b> gdal dev <<a
href="mailto:gdal-dev@lists.osgeo.org"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a>><br>
<b>Aihe:</b> [gdal-dev] Discrepancy in utilizing
overviews with gdalwarp</p>
</div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">I'd anticipate that both commands
would yield the same outcome:<br>
<br>
<span style="font-family:"Courier New"">$
gdalwarp -oo OVERVIEW_LEVEL=1 -dstalpha input.vrt
ovr1.tif<br>
$ gdalwarp -ovr 1 -dstalpha input.vrt ovr1.tif</span></p>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">However, the reality is
different. The first command behaves as intended,
utilizing overviews from
<code><span style="font-size:10pt">*.vrt.ovr</span></code>,
while the second command operates noticeably
slower, seemingly disregarding the overviews.</p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>