As with vector data, which comes in many different flavors (i.e., file formats), there is no single standardized file format for digital elevation models and other types of raster data. Although many GIS software packages have customized importers for particular DEM and raster data formats (e.g., the .dem file format used by the USGS or the files stored in the spatial data transfer standard (.ddf) files), there are hundreds of different file types in which the data may be stored. In this concept gallery item, we focus on one common type that has several variants: the ASCII file.
ASCII files are simple text files that consist of two main parts: a header that supplies basic information about the contents of the file and an array of values. Because these are text files, you can easily open them and examine their contents in any word processing program. The USGS .dem file format is in fact a type of ASCII file. Take a look at what one of these files looks like!
Most GIS software packages allow you to import ASCII files, but they may differ in what information they expect to find in the header portion of the file, the order in which the header information is displayed, and the order in which the values present in the data array are recorded. For this reason, it is useful to familiarize yourself with the formats that the software you use can work with. With this knowledge, it may be possible to easily modify a dataset so that you can import it into the particular software package you are using even if the software does not have a custom importer for the type of data you have.
Below are example ASCII files (of the same data) for two different GIS software packages, ArcGIS (Esri) and Surfer (Golden Software). What are the differences between these two formats?
Some of the information in the header is the same (e.g., the number of rows and columns), while some of the information is different. For example, the Surfer file uses a location range (e.g., the 0 7 entry) for the locational referencing instead of just specifying a starting point and cell size. The Surfer format also records the elevation data range (e.g., 8 25) instead of specifying a no data value. In the Surfer format, any values outside the specified range are considered invalid.
The other major difference is the order of rows in the file, with the Surfer values ordered from bottom to top (i.e., south to north) and the ArcGIS files ordered from top to bottom (i.e., north to south).
|ArcGIS ASCII file||Surfer ASCII file|
ncols 7 nrows 5 xllcorner 50 yllcorner 50 cellsize 100 nodata value -9999 13 20 19 15 14 13 11 15 18 18 17 12 11 10 15 16 17 16 10 9 11 17 18 21 18 14 14 8 20 21 25 21 17 16 16
DASS 7 5 0 7 0 5 8 25 20 21 25 21 17 16 16 17 18 21 18 14 14 8 15 16 17 16 10 9 11 15 18 18 17 12 11 10 13 20 19 15 14 13 11