1

How I can get TMS tiles (Z/X/Y.png) without getting them clamped in data range (e.g. GeoTIFF UInt16 -> Gdal2Tiles -> TMS UInt16 instead of GeoTIFF UInt16 -> Gdal2Tiles -> TMS Byte)?

1
  • 1
    By editing the source code of gdal2tiles or by cutting the tiles with some other tool, like gdal_translate tile by tile with the -spat option.
    – user30184
    Mar 23, 2021 at 17:48

1 Answer 1

0

There is rasterio extension named rio-tiler that can cut your georaster in TMS tiles. It has far more possibilities than gdal2tiles (I really tried to change gdal2tiles code, but I found it very hard to understand it), and it does not require you to convert georaster to uint8 before tiling your TIFF.

The usage example of it is quite simple:

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.