<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Michael,
<blockquote type="cite"
cite="mid:CAAcGz989o--av93yD2mJSTX-xPxdM_sap52coaiA4OoZuWQzAA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hi, can we specify overview sizes exactly?</div>
</blockquote>
<p>No, the BuildOverviews() interface onlys take an array of
overview factors. It is up to the driver implementation to decide
how it computes the overview size from the main raster size and
overview factor.</p>
<p>The COG driver is a bit of a special case, since it automagically
compute overviews if they don't exist in the source dataset, and
doesn't take an explicit list of overview factors. It simply
divides by two successively, with floor truncation:
<a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/blob/master/frmts/gtiff/cogdriver.cpp#L1092">https://github.com/OSGeo/gdal/blob/master/frmts/gtiff/cogdriver.cpp#L1092</a><br>
</p>
<blockquote type="cite"
cite="mid:CAAcGz989o--av93yD2mJSTX-xPxdM_sap52coaiA4OoZuWQzAA@mail.gmail.com">
<div dir="ltr"> I have this odd grid that is 36000x17999, and I
get consequently yucky overview sizes:
<div><br>
</div>
<div>gdal_create -outsize 36000 17999 -ot Int8 -co SPARSE_OK=YES
-a_srs EPSG:4326 -a_ullr 0 17999 0 36000 weird.tif<br>
gdal_translate weird.tif cog.tif -of COG<br>
gdalinfo cog.tif | grep Overviews<br>
# Overviews: 18000x8999, 9000x4499, 4500x2249, 2250x1124,
1125x562, 562x281, 281x14</div>
<div><br>
</div>
<div>Should I worry about this? </div>
</div>
</blockquote>
<p>Probably not ? :-)</p>
<blockquote type="cite"
cite="mid:CAAcGz989o--av93yD2mJSTX-xPxdM_sap52coaiA4OoZuWQzAA@mail.gmail.com">
<div dir="ltr">
<div> Can the sizes be specified via Translate? (I can see how
they could be generated externally and bundled, but I'm
looking for a way at this high level). <br>
</div>
</div>
</blockquote>
I guess someone could potentially add a
OVERVIEW_SIZES=W1xH1,W2xH2,... creation option to the COG driver if
that was really needed...<br>
<blockquote type="cite"
cite="mid:CAAcGz989o--av93yD2mJSTX-xPxdM_sap52coaiA4OoZuWQzAA@mail.gmail.com">
<div dir="ltr">
<div><br>
</div>
<div>( Maybe I shouldn't even care about the sizes ... and maybe
I should resample the grid to be a better overall size, but I
consider that out of scope here.)<br>
<div>
<div><br>
</div>
<div>I'm comparing with other COG creators, e.g. odc which
makes tidy overviews ( I will explore how it's getting
done). <br>
</div>
</div>
</div>
</div>
</blockquote>
<p>It looks like they might use (previous_size + 1) / 2 (or ceil
rounding)</p>
<span style="white-space: pre-wrap">
</span>
<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>