0

I have a GEOTiff file that has elevation data associated with it . It seems like the resulting png/jpg files I get after feeding it to gdal2tiles does not have elevation data. Same thing with the tms tiles provided by Geoserver. Does tiling a GEOTiff file strip away the elevation data?

  • 1
    Yes because tile servers are for pre-rendered basemaps, if you want to serve elevation data, look at OGC WCS. If you are just trying to chop up your GeoTIFF into smaller GeoTIFF files, edit your question and specify that. – user2856 Sep 2 '17 at 3:02
  • However, tile servers does not need to be limited to serve basemaps. Vector tiles is one example, another one is soon-to-come Gridded coverage data extension to the GeoPackage standard which is to large extent planned for saving digital elevation models as png or tiff tiles. – user30184 Sep 2 '17 at 9:58
2

Gdal2tiles is a Python script and you can check what is does from the source code or from your own computer where the script in in plain text in the GDAL directory. Link to the trunk version is https://trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/scripts/gdal2tiles.py

I am not so good in reading the code but script seems to read source data and split it into tiles in GDAL Memory format, and then a copy is written from MEM into png (row 1364).

GDAL png driver supports only byte and 16-bit unsigned data types http://www.gdal.org/frmt_various.html. I can't say directly it the script scales dataType into "byte" already when the MEM tile is created. If that happens the script should be able support 16-bit png tiles if the conversion into byte is first disabled and the source data type is 16-bit unsigned.

Nothing prevents from modifying gdal2tiles.py script to support tiles in other formats and bit depths but it requires some Python programming.

EDIT

Because it was not obvious for me from the code I made a test with a source image of type Uint16. Gdal2tiles converts also that into png tiles of type "byte".

The answer to the question is "Yes, gdal2tiles.py as the script stands at the moment creates tiles always as 8-bit per channel png images and elevation data is stripped".

  • Thanks for the help! While it's true I can edit gdal2tiles I don't see a way to change the way GeoServer chooses to tile. I wanted to use GeoServer because it has it's own caching. :/ oh well – ZackOfAllTrades Sep 5 '17 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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