Raw binary format

 

DSpRawBinary.pas

 

The raw binary format is a simple format that was developed in the early days of computing as a means to store and exchange raster data. It supports only one raster per file, which can have multiple bands that have a common data type. Only a few data types are supported. A header file is required to open the file. A third file with coordinate system information is optional.

General

Simple file-based format for a single raster with 1 or more bands having a single data type.

Read

The driver reads all common forms of raw binary files, with the exception of data in 1 and 4 bit lengths. 8 Bit data is interpreted as dspUInt8, 16 bit data as dspInt16, and 32 bit data as dspInt32. Other data types are not supported by this format. (You can use the gridmath module to convert the data to other types, if necessary.)

A header file with the same name as the data file but with a .HDR extension is required.

Starting skip bytes, row fill bytes, and band gap bytes are all supported. Conversion between little and big endian byte ordering is performed automatically. The ULXMAP and ULYMAP tie points are considered to represent the center of the upper-left pixel.

Write

The driver can write a new file, or modify an existing file. When modifying an existing file, the structure of the file (e.g. row fill bytes, band gap bytes, layout, byte ordering) is maintained. New files will always use big endian byte ordering, BIL layout, and no header bytes, row filler, or band gap bytes.

A header file is automatically created, if required, as well as a coordinate system information file.

Attributes This format does not include any attributes.
Coordinate system

If, when reading, a file with the same name as the data file but with a .PRJ extension is found, this file is parsed for coordinate system information. This information needs to be in the ESRI PRJ format. If no such file is found, or if the parsing is unsuccessful, a local coordinate system is assigned.

Documentation No additional documentation identified.
Data sources This format is a least-common-denominator for raster data, and most commercial packages support it in one form or another. Many data sources on the internet will also offer data in this format.
Developer information

Typically, the data files are in a flat binary layout, with no header bytes, row filler bytes, or band gap bytes, but all other layouts are supported. The accompanying header file can have the following keywords (in no particular order):

Keyword Meaning Default

NROWS

Number of rows. Required.  
NCOLS Number of columns. Required.  
NBANDS Number of bands. 1
NBITS Number of bit per value. Required.
BYTEORDER Byte ordering. I (Intel)
LAYOUT Layout of pixel values. BIL
SKIPBYTES Header bytes before bands. 0
ULXMAP X-coordinate of center of upper-left pixel. Required.
ULYMAP Y-coordinate of center of upper-left pixel. Required.
XDIM Pixel size in x direction. Required.
YDIM Pixel size in y direction. Must equal XDIM.
BANDROWBYTES Number of bytes that make up a row of data. Required.
TOTALROWBYTES Number of bytes that a row of data occupies in the file (includes row filler bytes). Optional. Defaults to BANDROWBYTES.
BANDGAPBYTES Number of filler bytes between successive bands in the file. 0
NODATA Value that indicates missing data. Required.

Keywords that do not have a default value must be present in the header file.


Go to SourceForge
Last modified: 17 January 2004. Page maintained by pvanlaake