4

I have an GeoTiff raster that contains elevation information at each pixel. As OpenLayers 2 can't display GeoTiff, I convert it to a PNG image and have to apply an exponential scale so the resulting pixels aren't all mostly white after only the lower elevation levels if I just use the -scale option without the -exponent option. However, I still need to know the elevation values at the pixels in the PNG image so I can display them via a color table lookup while mousing over the image. Is there a way for either GDAL or QGIS to export or save the resulting non-linear scaling equation and/or exponential factors that gdal_translate determined when creating the resulting PNG image?

Here's how I'm using gdal_translate and my values:

gdal_translate -of PNG -ot Byte -scale 0.2 2219 0 255 -exponent 0.35 image.tif image.png

I have made a determination what the equation may be. But, it would be good to know what it is exactly coming from gdal_translate.

3

According to the GDAL Virtual Format Tutorial the equation used is:

(DstMax - DstMin) * pow( (SrcValue - SrcMin) / (SrcMax - SrcMin), Exponent) + DstMin

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.