1

Right now I am trying to tile a GTiff into tiles to be used for e.g. Leaflet (so Mercator).

I played around with MapTiler and gdal2tiles. I am not entirely happy with both. Gdal2Tiles seems to pixelate the tiles, when I compare them to the tif. MapTiler cannot read the tif (I removed a band, MapTiler does not like that - also I want to be able to run the thing on a server, without GUI).

I also heard about TileMill, but TileMill seems to be deprecated.

So, I was wondering if there is any suitable alternative for tiling a GTiff?

BTW: the approach should be capable to tile a GeoTIFF with world-wide coverage.

2
  • 1
    Recognise that Mercator projection cannot be used for world-wide coverage. It is limited to a bit over 85N and 85S, and there is no polar coverage.
    – BradHards
    Commented Sep 17, 2016 at 12:00
  • Give an example of source file and gdal2tiles command that leads to pixelated output
    – user30184
    Commented Sep 17, 2016 at 14:02

4 Answers 4

5

GDAL natively now supports mbtiles and geopackages and does not rely on gdal2tiles.py use GDAL_Translate or GDAL_WARP

However check out gdal2tiles_parallel.py it's awesome fast https://github.com/GitHubRGI/geopackage-python/blob/master/Tiling/gdal2tiles_parallel.py

3
  • Thanks for the hint to gdal2tiles_parallel, that looks very interesting. How would I create tiles fom a GTif using eiter GDAL_Translate or GDAL_WARP - compareable to gdal2tiles?
    – Robin
    Commented Sep 18, 2016 at 6:16
  • gdal2tiles_parallel.py is faster and adds all the zoom levels/overviews where gdal_translate and gdal_warp just do the lowest zoom level (equivalent 1:1) Commented Oct 17, 2016 at 17:48
  • @Robin See gdal.org/frmt_mbtiles.html $ gdal_translate my_dataset.tif my_dataset.mbtiles -of MBTILES $ gdaladdo -r average my_dataset.mbtiles 2 4 8 16 Commented Sep 26, 2018 at 8:00
3

You can try Qtiles - QGIS plugin to tile your tiff. See https://plugins.qgis.org/plugins/qtiles/ and http://gis-lab.info/qa/qtiles-eng.html

2

Expanding on @GeospatialInformationTech's answer, with GDAL's native MBTiles support you can do:

$ gdal_translate my_dataset.tif my_dataset.mbtiles -of MBTILES
$ gdaladdo -r average my_dataset.mbtiles 2 4 8 16

You can then use mbutil to expand that MBTiles into files:

$ mb-util my_dataset.mbtiles tiles
2

Try rio-tiler. Powerful, dtype-independent, won't start type conversion or something unless explicitly stated. Founded on rasterio, which written in Cython, so the tiling will be fast.

Example usage:

from rio_tiler.io import COGReader

with COGReader("my.tif") as image:
    img = image.tile(x, y, z) # read mercator tile z-x-y

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.