[Gdal-dev] Bug reading GMT files

Timothy Rupe twoslick at gmail.com
Fri Jun 9 11:40:48 EDT 2006


I've started using gdal_translate to convert a Generic Mapping Tools (GMT)
grid file to an Erdas Imagine Images (HFA) using the following command:
gdal_translate finaldem.grd -of HFA finaldem.img

Everything appears to work correctly, but the resulting elevation file is
translated towards the lower border.  For example, if the top of the DEM was
at latitude 40, and the bottom at 39, then the resulting file after the
conversion has its top at 39, and bottom at 38.

Gdal appears to incorrectly read the boundary values in GMT files, so the
lower and upper values are swapped:
tmp $ gdalinfo finaldem.grd
Driver: netCDF/network Common Data Format

<snip>

Corner Coordinates:
Upper Left  (-124.4998627,  40.0001373)
Lower Left  (-124.4998627,  40.4998627)
Upper Right (-124.0001373,  40.0001373)
Lower Right (-124.0001373,  40.4998627)
Center      (-124.2500000,  40.2500000)

<snip>

The real values of the boundaries are shown here:
grdinfo finaldem.grd
finaldem.grd: Title: user_z_unit
finaldem.grd: Command: grdcut surface.grd -Gfinaldem.grd -R-124.5/-124.0
/40.0/40.5
finaldem.grd: Remark:
finaldem.grd: Pixel node registration used
finaldem.grd: grdfile format: nf (# 18)
finaldem.grd: x_min: -124.5 x_max: -124 x_inc: 0.000277778 name: user_x_unit
nx: 1800
finaldem.grd: y_min: 40 y_max: 40.5 y_inc: 0.000277778 name: user_y_unit ny:
1800
finaldem.grd: z_min: -1052.48 z_max: 1237 name: user_z_unit
finaldem.grd: scale_factor: 1 add_offset: 0



Thanks,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060609/eed638aa/attachment.html


More information about the Gdal-dev mailing list