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?
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.
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".