Show/Hide Toolbars

Redbex supports importing DEM data from files in ESRI ASCII raster format also known as ARC/INFO ASCII GRID. This file format is widely used in the GIS world as an exchange, or export format, for raster data.

The file defines the geographic space as an array of equally sized square grid points arranged in rows and columns. Each grid point stores a numeric value that represents a geographic attribute (in this case the elevation) for that unit of space.

The file begins with header information that defines the properties of the raster such as the cell size, the number of rows and columns, and the coordinates of the origin of the raster. The header information is followed by cell value information specified in space-delimited row-major order, with each row separated by a carriage return. The values use the point as decimal separator.

Header format

The header of the file contains a list of keyword value pairs separated by carriage return. Keyword and value are separated by one or more space characters. Table one lists the recognized keywords.  All other keywords will be ignored. Keywords are case insensitive. The value in the keyword value pair is always a numeric value.

The parameters in the header part of the file must match correctly with the structure of the data values.

Keyword

Description

NCOLS

Number of cell columns

Integer greater than 0

NROWS

Number of cell rows

Integer greater than 0

XLLCENTER or XLLCORNER

X coordinate of the origin (by center or lower left corner of the cell).

Match with Y coordinate type.

YLLCENTER or YLLCORNER

Y coordinate of the origin (by center or lower left corner of the cell).

Match with X coordinate type.

CELLSIZE

Cell size.

Greater than 0

NODATA_VALUE

The input values to be NoData in the output raster.

Optional. Default is -9999

Table 1: Keywords in the header of a ESRI ASCII grid file.

Data format

The data component of the file follows the header information. The first data line is the first line in the file that does not start with an alphabetic character (A-Z).

Cell values are delimited by spaces. No carriage returns are necessary at the end of each row in the raster. The number of columns defined in the header determines when a new row begins.

Row 1 of the data is at the top of the raster, row 2 is just under row 1, and so on.

Following rules apply when parsing numbers:

The numeric string can have a leading sign, + for positive and - for negative values.

The numeric string can include a decimal separator, the decimal separator can be point or comma but must be the same throughout the whole file.

The numeric string can be in exponential notation. The numeric string may contain an exponent that begins with the E or e character and that is followed by an optional positive or negative sign and an integer. In other words, it successfully parses strings in the form nnnExx , nnnE+xx , nnnE-xx

ncols 1683

nrows 1719

xllcorner 660302

yllcorner 6575838

cellsize 2

nodata_value -3.4028230607371e+038

24.9099998474121 25.0900001525879 25.0699996948242 25.0499992370605 25.0300006866455 25.0799999237061 25.1700000762939 25.2399997711182 25.2399997711182 25.3500003814697 25.3500003814697 25.3500003814697 25.4300003051758 25.4899997711182 25.3500003814697 25.3899993896484 25.4300003051758 25.4500007629395 25.4899997711182 25.5200004577637 25.5900001525879 25.5300006866455 25.5499992370605 25.6599998474121 25.7399997711182 25.75 25.8999996185303 25.9699993133545 26.1700000762939 26.4099998474121 26.5799999237061 26.9300003051758 27.3999996185303

Listing 1: Example of an ESRI ASCII grid file (truncated)

© 2021 AFRY Austria GmbH, www.redbex.com