3

I am very new to GIS and setting up COG servers.

The problem I am facing:

I am unable to serve my DEMs/DSMs, which are in GeoTIFF format, as .png map tiles (z/x/y.png) using a tiling server "TiTiler", which is based on riotiler. However for normal RGB raster TIFFs, it works fine. I am not at all sure how to interpret DEM/DSM COGs to tiling server. Titiler has an API endpoint which returns the GeoTIFF information and type. See this is the output when I feed in both RGB TIFF and my DEM:

DEM:

{
    "bounds": [88.42379642445006, 22.56651317616363, 88.44287051283406, 22.58178886547563],
    "band_metadata": [
        [1, {}]
    ],
    "band_descriptions": [
        [1, "band1"]
    ],
    "dtype": "float32",
    "colorinterp": ["gray"],
    "nodata_type": "Nodata"
}

RGB TIFF:

{
    "bounds": [88.42379642445006, 22.56651317616363, 88.44287045398606, 22.58178886547563],
    "band_metadata": [
        [1, {}],
        [2, {}],
        [3, {}],
        [4, {}]
    ],
    "band_descriptions": [
        [1, "band1"],
        [2, "band2"],
        [3, "band3"],
        [4, "band4"]
    ],
    "dtype": "uint8",
    "colorinterp": ["red", "green", "blue", "alpha"],
    "nodata_type": "Alpha"
}

Clearly the DEM file is a single band TIFF, and also float32 image file. Now the issue I am facing here is, Titiler (map tile server), is not able to generate PNG files based on float32 TIFF.

As of now I am really confused how to go about this. My only goal is to generate .png maptiles from my DEMs/DSMs, so that I can overlay them on Google Maps.

1
  • Could you share your solution with us please? Commented Nov 9, 2020 at 14:01

1 Answer 1

3

Titiler (map tile server), is not able to generate PNG files based on float32 TIFF

PNG is not able to encode Float32, it's not TiTiler fault. You need to rescale the data to bytes (0-255) or to use the Mapbox/Mapzen trick (https://github.com/mapbox/rio-rgbify or https://github.com/cogeotiff/rio-tiler/blob/master/rio_tiler/utils.py#L364-L378) to encode elevation into a 3 bands PNG.

In TiTiler you can set the rescaling values (min/max bounds to rescale from) directly in the query string (see the rescale parameter in https://api.cogeo.xyz/docs#/Cloud%20Optimized%20GeoTIFF/tile_cog_tiles__z___x___y__get)

More on Dynamic Tiling: https://developmentseed.org/titiler/concepts/dynamic_tiling/

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.