gdal_translate fails on GRD grid
|Reported by:||mladen||Owned by:||warmerdam|
|Severity:||major||Keywords:||grd, vertical mapper, northwood, gdal_translate|
Description (last modified by )
NOTE: This is probably not gdal_translate specific, but rather a bug in the Northwood Vertical Mapper .grd driver. However, I didn't want to jump to conclusions and so am describing exactly how I came across the issue, which was with gdal_translate.
Suppose we start with a large, mostly empty grid (45Mb zipped, ~4Gb unzipped): http://dl.dropbox.com/u/53500018/translateBug/original_30m_grid.zip
This grid has a resolution (pixel size) of 30m, and looks like this when I open it in a viewer: http://dl.dropbox.com/u/53500018/translateBug/original.png
However, if I try to translate it with "gdal_translate", with the following command:
gdal_translate -of png -b 1 -b 2 -b 3 -outsize 10% 10% "original30m.grd" resolution30.png
I get garbled, warped output near the bottom of the grid:
It is evident also that a large chunk of the grid has been cut off at the bottom.
This seems to be related to the large file size of the original grid, because I can downsample it to lower resolutions, and the lower the resolution, the better the output. For example:
Downsampled to 35m:
37m (notice that less is cut off at the bottom, but still warped):
By 45m, it looks OK, but I doubt that it would look OK if there were data near the bottom of the grid extent.
And by 60m, everything is clearly fine:
For convenience, here is the original grid downsampled to 60m resolution (22Mb zipped, ~1Gb unzipped):
Rather than resizing, I can also cut the original grid in 2 halves, and get good output. Unfortunately, I can't do this in every case, since I'm using GDAL as part of an automated process.
So, obviously the wheels fall off somewhere around 2 Gb grid size, or 45m resolution in this case. The 30m is a good sample grid for the "bad" case, and the 60m is a good sample for the "good" case, but if more samples are needed let me know.
P.S. The aux.xml files for each of the PNGs above are available just by adding ".aux.xml" to the link (except original.png, which is a screen cap).