DEM File Formats

As with raster image files, there is not a single standardized file format for digital elevation models. Almost every data provider and every software manufacturer specifies their own file format. This leads to a wide variety of different file formats for digital elevation models. The following list summarizes a few of the more important file formats for Digital Elevation Models (DEMs) in grid form. TINs require more complex formats (such as dxf) that are not presented here.


Digital elevation models provided by the USGS and the Canadian CTI use the DEM or SDTS format. The DEM file format specified by the USGS is an ASCII format – viewable with any text editor. Most relief shading and terrain manipulation applications can import the DEM file format. The file extension is “.DEM”.

SDTS (Spatial data transfer standard) is a very complex format designed to store different types of geographical data. A single data set consists of about 20 different files. When working with SDTS data, it is important to keep and move these files together in a single directory. Due to its complexity, support for the SDTS format is not as widespread as the DEM format. The different files forming a SDTS data set have the “.DDF” file extension.


ESRI, the leading provider of geographical information systems, defines its own file formats for grids. These formats (a binary and an ASCII version) are widely supported by other software packages. The ASCII version is very simple and is editable with any text editor. A file starts with a short header describing the location and the size of the grid. Following the header, elevation values read from left to right, starting with the northernmost row.

The following six lines form a valid header:

ncols 10
nrows 8
xllcorner 637500.000
yllcorner 206000.000
cellsize 500.000
NODATA_value -9999

The first two lines (“ncols” and “nrows”) specify the size of the grid. The third and the fourth lines specify the horizontal (“xllcorner”) and vertical (“yllcorner”) coordinates of the lower left corner of the grid. “cellsize” is the distance between two adjacent rows or columns. The last row (“NODATA_value”) is optional and specifies a value considered as “not valid”.


Surfer by Golden Software is an application for 3D surface modelling and geostatistical analysis. Surfer uses its own file formats, one of them being a very simple ASCII format. Many other programs also support this format. The file with the extension “.GRD” contains five header lines and the data in regular grid are ordered from left to right and from bottom to top. The first line always contains “DSAA”. The next line specifies the number of grid columns and rows. The third and the fourth line contain the boundaries of the grid in horizontal and vertical direction. The last line of the header contains the smallest and the largest valid value of the grid. Values larger or smaller than these two are considered “void” or “not valid”.

The following example grid file is 3 rows high by 2 columns wide. X ranges from 0 to 9, Y ranges from 0 to 7, and Z ranges from 60.55 to 96.04. The first Z value shown corresponds to the lower left corner of the map and the following values correspond to the increasing X positions along the bottom row of the grid file. This file has a total of 6 Z values.

2 3
0.0 9.0
0.0 7.0
60.55 96.04
91.03 60.55
96.04 62.38
92.10 65.09

PGM (Portable Graymap)

PGM is a very simple ASCII format that stores gridded data. The content is as follows: A “magic number” for identifying the file type. A pgm file’s magic number is the two characters “P2”. The following line contains the width and height of the grid. The next line specifies the maximum value in the grid, followed by the grid itself, starting at the top-left corner. No line should be longer than 70 characters. Comments can be inserted if the line starts with “#”. The following lines are an example of a valid PGM file (2×2 values):

# a PGM sample
2 2
35 66
13 56