[gdal-dev] MBTiles blurry

Kanishk Varshney varskann1993 at gmail.com
Thu Jun 30 05:06:28 PDT 2022


So these flags I have tried .. nearest was the one giving best out of these
re sampling methods!


Lanczos and Average re sampling both smoother the edges etc and blur the
overall image even further!


On Thu, 30 Jun 2022 at 4:58 PM, Even Rouault <even.rouault at spatialys.com>
wrote:

> 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)
>
> 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
>
> Try also adding -co RESAMPLING=LANCZOS in the gdal_translate stage.
>
> If you don't need MBTiles format and WebMercator projection, I'd say just
> stick with GeoTIFF, and possibly use the COG driver:
> https://gdal.org/drivers/raster/cog.html
> Le 30/06/2022 à 13:18, Kanishk Varshney a écrit :
>
> Hey Even,
> Thanks for the quick response.
>
> 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
>
> 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!
>
> Thanks,
> Kanishk
>
> On Thu, Jun 30, 2022 at 3:37 PM Even Rouault <even.rouault at spatialys.com>
> wrote:
>
>> Kanishk,
>>
>>
>> And my GDAL commands are:
>>
>> gdalwarp -srcnodata 0 -dstalpha infile.tif outfile.tif
>>
>>  gdal_translate -tr 0.035 0.035 -co 'QUALITY=100' -of MBTILES outfile.tif outmbtile.mbtiles
>>
>> gdaladdo -r nearest outmbtile.mbtiles 2 4 8 16
>>
>> 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.
>>
>> 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.
>>
>> Same for gdaladdo: you should'nt use nearest neighbour reampling for good
>> quality
>>
>> 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
>>
>> Also, the opening option ZOOM_LEVEL seems to error out(Using with -oo "ZOOM_LEVEL=9)
>>
>> 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.
>>
>> Even
>>
>> -- http://www.spatialys.com
>> My software is free, but my time generally not.
>>
>> -- http://www.spatialys.com
> My software is free, but my time generally not.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220630/bbdd01ca/attachment.htm>


More information about the gdal-dev mailing list