ARC ASCIIGRID refers to a specifc interchange format developed for ARC/INFO rasters in ASCII format. The format consists of a header that specifies the geographic domain and resolution, followed by the actual grid cell values. Usually the file extension is .asc, but recent versions of ESRI software also recognize the extension .grd. It looks like this:

Records 1 - 6 Geographic header

Coordinates may be in decimal or integer format. DD:MM:SS format for geodetic coordinates is not supported.

ncols xxxxx

ncols refers to the number of columns in the grid and xxxxx is the numerical value

nrows xxxxx

nrows refers to the number of rows in the grid and xxxxx is the numerical value

xllcorner xxxxx

xllcorner refers to the western edge of the grid and xxxxx is the numerical value

yllcorner xxxxx

yllcorner refers to the southern edge of the grid and xxxxx is the numerical value

cellsize xxxxx

cellsize refers to the resolution of the grid and xxxxx is the numerical value

nodata_value xxxxx

nodata_value refers to the value that represents missing data and xxxxx is the numerical value. This isoptional and your parser should not assume it will be present. Note: that if you need a good value, the ESRI default is -9999.

Record 7 -> end of file Data values

These are the value of individual cell typically representing elevation of a particular area.

xxx xxx xxx

val(nox,noy) (f) = individual grid values, column varying fastest in integer format. Grid values are stored as integers but can be read as floating point values.

xllcorner and yllcorner are given as the EDGES of the grid, NOT the centers of the edge cells. ARC/INFO supports other header strings that allow the centers of the edge cells to be given using xllcenter and yllcenter instead. The origin of the grid is the upper left and terminus at the lower right.

For the nodata_value it might be tempting to use a non-numeric value such as "NA" for efficiency, however this is not valid and files structured this way will not load into any of the ESRI tools such as ArcCatalog and ArcMap. I tried this with version 9.2 of ArcCatalog.