Ticket #4395 (closed defect: fixed)
NWT_GRD doesn't always generate correct color palette
|Reported by:||rouault||Owned by:||rouault|
Issue reported in http://lists.osgeo.org/pipermail/gdal-dev/2011-December/031170.html :
Hi all, I am trying to use gdal_translate to convert a .grd file (Northwood/VerticalMapper format) to TIFF. However, the colors in the translated file don't seem to be interpolated correctly based on the color scheme, for values near the end of the range. Here is a link to the original GRD, as well as the exported TIFFs (small download, only 200K): http://dl.dropbox.com/u/53500018/GdalQuestion.zip The GdalTranslateExport.tif file was produced with the command "gdal_translate -b 1 -b 2 -b 3 C:\source\Ottawa_east_DEM30m_trim_copy.grd C:\temp\GdalTranslateExport.tif". Notice the top and bottom areas of the image: they are yellow. For comparison, take a look at the NativeExport.tif file in the same package. The top and bottom areas are orange, as they should be. The NativeExport.tif file was produced by Pitney Bowes MapInfo. Here is the color scheme for the GRD: http://www.smugmug.com/photos/i-bRZ879w/0/X3/i-bRZ879w-X3.jpg Notice that the thresholds are "70" for yellow, and "161" for orange. Well, the values at the top and bottom are in the high 130s/low 140s. So they should be interpolated close to orange, not yellow. Therefore the NativeExport.tif is correct, and the gdal_translate export is incorrect. I have also tried changing the thresholds, and as soon as I change the orange threshold to be below the maximum actual value in the GRD (let's say 144), the gdal_translate export shows the orange shades. So, it seems there might be a bug in gdal_translate where color values are not interpolated correctly for thresholds that fall outside of the range of actual values? Or is there a way to make gdal_translate behave the way that I want with some different command line options? Regards, Mladen Gavrilovic P.S. For convenience, here is a gallery with the TIFFs converted to JPEG (difference is still obvious), and the color scheme: http://smu.gs/vMEemF P.P.S Version of GDAL is 1.8.1
After some digging, it turns out that in the situation where the maximum z is below a threshold of the color scheme, we were interpolating the zmin value and not the zmax one.