The MDR file format is a simple format that consists of a 1024-byte header followed by a raster block of 32-bit floating-point samples. Byte order of all fields and data is Intel order (LSB first). The VC++ structure definition for the file header is shown below:
Code:
// make sure we're aligned on 2-byte boundaries for this declaration
#pragma pack(push)
#pragma pack(2)
// map structure definitions
struct MDRHeader
{
union
{
struct
{
char Chunk[4]; // name of chunk - should be "WLBR"
int Next; // offset in file to next data (unused)
char Name[256]; // name associated with the data (unused)
double Left; // min longitude
double Right; // max longitude
double Top; // max latitude
double Bottom; // min latitude
double Min; // lowest point on surface
double Max; // highest point on surface
double XRes; // distance between X points (right - left) / XSize
double YRes; // distance between Y points (top - bottom) / YSize
int Version; // version number (unused, should be 0)
int TypeInfo; // type information (should always be 0)
char SurfName[8]; // name of data block (unused)
void** SurfData; // pointer to surface data (unused)
char PicName[8]; // name of picture block (unused)
void** PicData; // pointer to image data (unused)
int XSize; // width of blocks
int YSize; // height of blocks
}; // struct
struct
{
char Padding[1024]; // make the structure 1024 bytes long
};
}; // union
}; // MDRHeader
#pragma pack(pop)
There is a problem with 32-bit MDR vs. 64-bit MDR files embodied in the pointers in the structure. There will likely be an offset from 32-bit vs 64-bit files.