Welcome to our new forum platform. We realize there is still some work to do and we appreciate your patience. Please let us know if you have any ideas or suggestions: paul@globalmapperforum.com

Global mapper grid file

kartoone76kartoone76 Global Mapper UserPosts: 38Trusted User ✭✭
edited March 2008 in Elevation Data
Is there a way to extract the bounding coordinates from a global mapper grid (GMG) file? It appears to be a binary file and a quick scan of the file didn't reveal anything that would hint at the location of where the bounding coordinates would be. Is there a specific byte location or does the entire file have to be parsed in order to find out the bounding coordinates?

As an alternative, I am prepared to write a script that would use the EXPORT_METADATA command to export the metadata (which I presume would include the bounding coordinates) for all loaded GMG files and then create a separate non-global mapper script to re-process the exported .txt file to extract the bounding coordinates. I was just wondering if there is an easier way.



  • global_mapperglobal_mapper Administrator Posts: 17,238BMG Staff ✭✭
    edited March 2008
    It is a binary file. Here is the C declaration of the header from which you can extract the bounding box:

    struct PackedHeader_t
    sint32 mHeaderSize; // Size of entire header
    uint32 mMagicNumber; // Magic number
    double mMinX; // X coordinate of center of top left sample
    double mMaxY; // Y coordinate of center of top left sample
    double mPixelSizeX; // Ground size of a pixel in the X direction
    double mPixelSizeY; // Ground size of a pixel in the Y direction
    sint32 mImageWidth; // Total number of valid pixels in a row
    sint32 mImageHeight; // Total number of valid pixels in a column
    uint8 mTilePowerX; // 1 << Total number of samples in a tile row
    uint8 mTilePowerY; // 1 << Total number of samples in a tile column
    sint8 mElevUnits; // Elevation units (same as ViewerUtils)
    sint32 mMinZ; // Minimum elevation
    sint32 mMaxZ; // Maximum elevation

    // Offsets to tables and other values
    uint32 mProjOffset; // Offset to embedded projection string
    uint32 mProjSize; // Size of embedded projection string
    uint32 mLayerTableOffset; // Offset to layer table
    uint32 mLayerTableSize; // Size of layer table
    uint32 mLayerTableRecSize; // Size of layer table record
    uint32 mTileSizeTableOffset; // Offset to table of tile sizes
    uint32 mTileSizeTableRecSize; // Size of tile size table record
    uint32 mTileTableOffset; // Offset to the tile data table

    Let me know if I can be of further assistance.


    Global Mapper Support
Sign In or Register to comment.