Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#4395 closed defect (fixed)

NWT_GRD doesn't always generate correct color palette

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:


Issue reported in :

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):

The GdalTranslateExport.tif file was produced with the command
"gdal_translate -b 1 -b 2 -b 3  

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:

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  

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?

Mladen Gavrilovic

P.S.  For convenience, here is a gallery with the TIFFs converted to  
JPEG (difference is still obvious), and the color scheme:

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.

Change History (2)

comment:1 Changed 5 years ago by Even Rouault

Resolution: fixed
Status: newclosed

r23577 /trunk/gdal/frmts/northwood/ (grddataset.cpp northwood.cpp): NWT_GRD: fix interpolation of color when the maximum z value is below a threshold of the color scheme (#4395)

r23578 /branches/1.8/gdal/frmts/northwood/northwood.cpp: NWT_GRD: fix interpolation of color when the maximum z value is below a threshold of the color scheme (#4395)

comment:2 Changed 4 years ago by Even Rouault

Milestone: 1.8.2

Milestone 1.8.2 deleted

Note: See TracTickets for help on using tickets.