[Gdal-dev] question about AsciiGrid (take two)

Stephane Routelous route at cae.com
Fri Apr 15 11:31:33 EDT 2005

sorry, I hit send before having finish to write the mail (damn keyboard
here is the good version:

In our framework, we are encapsulating GDAL.
For all the raster and elevation formats, we define that the value for a
pixel is specified at its center.
This means that, when we are accessing a position in the data with a
georeference, we interpolate between the 4 pixels around the requested
In my code, I put the 4 corners of the dataset into GCP
(GDALCreateGCPTransformer) and I'm using GDALGCPTransform to get the pixel
as double.
the problem that I'm facing is for asciigrid.
In an elevation data (asciigrid or dted), the pixels are representing a
posting point, and not a surface.
This means that outside the box defined by the lowerleft and the upperleft
postings, the data is not defined.
For a DTED, all is fine, because a dted posting is defined a the lowerleft
corner of the pixel.
But for the asciigrid, the definition of the pixel posting is defined in the
file itself.
So, if the asciigrid is defined with xllcenter and yllcenter, asking for a
pixel between [0,0.5[ or ]nXSize-0.5,nXSize] returns an undefined value
(same for y).
in the case where the asciigrid is defined with xllcorner/yllcorner, the
undefined values are from ]nXSize-1,nXSize]

In my framework, I change the georeferenced bounding box to take in account
this 1/2 pixel displacement.
But for asciigrid, I need to know if the asciigrid is defined with
xllcenter/yllcenter or xllcorner/yllcorner.

Is there a way to get this information, once I have the GDALDataset ?
Should GDAL take care of that, instead of defining the adfGeoTransform to
enclose all the pixels ?
How the GDAL users are handling this case ?

Thanks in advance for your help,

Stephane Routelous


More information about the Gdal-dev mailing list