In the Esri world an .asc
file usually refers to the output created by the GRIDASCII command (ArcInfo Workstation) or Raster to ASCII tool (ArcGIS for Desktop). In practice it can mean just about any format, usually plain text, meaning one can't assume from the .asc
extension what it looks like inside.
It's an interchange format, meaning it's not (normally) used as input for analysis or primary storage, but for exchange with other programs.
The Esri ASCII Raster format can use either integer or floating point numbers for the Z (cell) value. These are both valid:
NCOLS 480
NROWS 450
XLLCORNER 378922
YLLCORNER 4072345
CELLSIZE 30
NODATA_VALUE -9999
43 2 45 7 3 56 2 5 23 65 34 6 32 54 57 34
35 45 65 34 2 6 78 4 2 6 89 3 2 7 45 23 5 ...
NCOLS 480
NROWS 450
XLLCORNER 378922
YLLCORNER 4072345
CELLSIZE 30
NODATA_VALUE -32768
43.245 7.356 2.523 6.534 6.325 57.34
35.456 34.267 4.268 32.745 23.5 ...
The Esri GRID format, also called Arcinfo Binary Grid, is comprised of multiple files in a single directory (.hdr
,.adf
,...) and whose contents are opaque (looks like gobbledygook in a text editor). The grid specification is unpublished, but has been very successfully reverse engineered. Binary Grid is the default raster format for ArcInfo Workstation (actually comes from its GRID program) and is used as primary storage and analysis input.
You didn't ask about this, but for completeness: there is also the Esri floating point grid interchange file format. It is not used for primary storage or analysis.
Floating point grids are created from the GRIDFLOAT (ArcInfo Workstation) command or Raster to Float (ArcGIS for Desktop) tool and typically has a .flt
extension for the raw values (binary encoded), and side car .hdr
file describing the format. The .hdr is plain text and resembles the beginning of an .asc file:
ncols 382
nrows 425
xllcorner 217996.296875
yllcorner 708952.625
cellsize 300.0741885626
NODATA_value -9999
byteorder LSBFIRST
In practice, if you have a file of unknown format that you think might be a raster, show it to gdalinfo from gdal and it will usually be able to uncover what it is:
D:\> gdalinfo strange_file.raw
Driver: AAIGrid/Arc/Info ASCII Grid
Files: strange_file.raw
Size is 382, 425
Coordinate System is `'
Origin = (217996.296875000000000,836484.155139103760000)
Pixel Size = (300.074188562596990,-300.074188562596990)
Corner Coordinates:
Upper Left ( 217996.297, 836484.155)
Lower Left ( 217996.297, 708952.625)
Upper Right ( 332624.637, 836484.155)
Lower Right ( 332624.637, 708952.625)
Center ( 275310.467, 772718.390)
Band 1 Block=382x1 Type=Int32, ColorInterp=Undefined
NoData Value=-2147483648
.
D:\>gdalinfo strange_file_too.raw
Driver: EHdr/ESRI .hdr Labelled
Files: strange_file_too.flt
strange_file_too.hdr
strange_file_too.prj
Size is 382, 425
...snip...
Band 1 Block=382x1 Type=Float32, ColorInterp=Undefined
NoData Value=-9999
...and then use gdal_translate to convert it something useful if you don't have ArcGIS for Desktop handy.