[gdal-dev] FW: Vertical Mapper grid format

Ned Harding nharding at extendthereach.com
Mon Jul 14 16:23:46 EDT 2008


FYI - I got this email about the GRD file format and posting it in case other people are interested.

ned.

---------------------------------------
I saw your postings on gmane.comp.gis.gdal.devel and tried to answer them on that forum, but my posting was rejected because I was not subscribed to that group. Below is some more info on this format which you may find useful. This has been determined by reverse engineering example files. You're welcome to post this info on the forum, but please leave my email address off. Ta.

----

The information Andrew provided agrees with what I have found out about this format, but below is a bit more detail.

The first 5 bytes of the file can also be "HGPC8" if the grid is classified. In this case the file extension with be ".GRC" instead of ".GRD". Classified grids can store either an 8-bit or 16-bit value for each grid cell. To determine which it is you need to look at the byte at offset 1023. This will normally be zero for a GRD grid, but for GRC grids, it can be either 0 or 2. A value of 0 means values are 16-bit, while a value of 2 means values are 8-bit. 16-bits are used if there are 255 or more classes.

Note that the (MinX,MinY) position is the centre of the bottom-left cell.

Offset 0: "HGPC1" or "HGPC8"
Offset 5: Version number (4-byte float) - usually 1.0 or 2.0
Offset 9: Number of columns (2-byte short)
Offset 11: Number of rows (2-byte short)
Offset 13: Min X (8-byte double)
Offset 21: Max X (8-byte double)
Offset 29: Min Y (8-byte double)
Offset 37: Max Y (8-byte double)
Offset 45: Min Z (4-byte float)
Offset 49: Max Z (4-byte float)
Offset 61: String describing the grid
Offset 93: String for units used e.g. "meters"
Offset 256: Coordinate system string in MapInfo format e.g. "CoordSys Earth..."
Offset 512: Units code (1 byte). Codes 0 thru 32 are same as MapInfo's ones, 
others are unique to Vertical Mapper.
Offset 513: Display flags (1 byte)
Offset 516: Number of colours in colour/inflection table (2-byte short)
Offset 518: Colour/inflection table (7 bytes per entry: 4-byte float value, 
then R G B bytes)
Offset 966: Shading azimuth (4-byte float)
Offset 970: Shading inclination (4-byte float)
Offset 1023: Value size indicator (0 if 2-byte values, 2 if 1-byte values)
Offset 1024: Grid data (either 1-byte or 2-bytes per grid cell)

The grid data can be followed by relief shading data (1 byte per grid cell) if bit 6 of the display flags is set.

If the grid is classified, a table follows the grid data which contains an 
entry for each class including the value, RGB colour, and a label. The label can include hierarchical components (separated by "/"'s) to allow it to be displayed in a tree in Vertical Mapper.

Cheers,
Anthony.





More information about the gdal-dev mailing list