<div dir="auto">So these flags I have tried .. nearest was the one giving best out of these re sampling methods! </div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Lanczos and Average re sampling both smoother the edges etc and blur the overall image even further! </div><div dir="auto"><br></div><div dir="auto"><br></div><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 30 Jun 2022 at 4:58 PM, 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">
<div>
<p>You can perhaps try -r lanczos . It is good at preserving sharp
details (but can also create artifacts on other situations.
there's nothing as a universally good resampling method)</p>
<p>Ah, and one point I forgot is that when going to MBTiles, an
implicit reprojection to Web Mercator is also done by the MBTiles
driver, which involves another resampling</p>
<p>Try also adding -co RESAMPLING=LANCZOS in the gdal_translate
stage.</p>
<p>If you don't need MBTiles format and WebMercator projection, I'd
say just stick with GeoTIFF, and possibly use the COG driver:
<a href="https://gdal.org/drivers/raster/cog.html" target="_blank">https://gdal.org/drivers/raster/cog.html</a><br>
</p></div><div>
<div>Le 30/06/2022 à 13:18, Kanishk Varshney
a écrit :<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hey Even,
<div>Thanks for the quick response. <br>
<div><br>
</div>
<div>If you notice the MBTiles, the finer details(cracks on
Road, etc) and edges are all blurred. I tried the -r average
flag as well but the result was almost similar</div>
<div><br>
</div>
<div>I am more interested in preserving those details while
reducing the size of the data. So any other approach or
format that might suit my use case will be appreciated as
well!</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Kanishk</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Jun 30, 2022 at 3:37
PM Even Rouault <<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.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>
<p>Kanishk,</p>
<br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr">
<div><br>
</div>
<div>And my GDAL commands are:</div>
<div><br>
</div>
<div>
<pre><span>gdalwarp -srcnodata 0 -dstalpha </span><span>infile.tif outfile.tif</span></pre>
<pre><span>
</span></pre>
<pre><pre><span>gdal_translate -tr 0.035 0.035 -co 'QUALITY=100' -of MBTILES outfile.tif</span><span> outmbtile.mbtiles</span></pre><pre><span>
</span></pre><pre><pre><span>gdaladdo -r nearest outmbtile.mbtiles</span><span> 2 4 8 16</span></pre></pre></pre>
</div>
</div>
</div>
</div>
</blockquote>
<p>The above gives a OK result for me with
topveiw_sample.tif as input. Note that you don't need the
first gdalwarp step as your file has already an alpha
band.</p>
<p>To improve quality you should add for example -r average
to gdal_translate otherwise nearest neighbour reampling
will be used, which is generally a bad idea.</p>
<p>Same for gdaladdo: you should'nt use nearest neighbour
reampling for good quality<br>
</p>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr">
<div>
<pre><pre><pre><span>
</span></pre><pre>If I am trying to improve the target resolution even further(reducing -tr value) , it corrupts the output mbtile and a blank or blurred tile gets generated</pre><pre>Also, the opening option ZOOM_LEVEL seems to error out(Using with -oo "ZOOM_LEVEL=9)</pre></pre></pre>
</div>
</div>
</div>
</div>
</blockquote>
<p>If you look at the output of gdalinfo on the generated
mbtiles file, you'll see that the full resolution is at
zoom level 22, and given the dimensions of the file only 2
overview levels were generated. So the minimum zoom level
at which you can open that file is 20.</p>
<p>Even</p>
<pre cols="72">--
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</div>
</blockquote>
</div>
</blockquote>
<pre cols="72">--
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</div>
</blockquote></div></div>