Global Mapper v25.0

how to change the projection in GeoTiff

gugupo Global Mapper UserTrusted User
edited June 2012 in SDK

how to change the projection in GeoTiff

I am making the prj file from GlobalMapper. and

Prj file is read using the GM_LoadProjectionFile().

but Value will appear incorrectly.

What's wrong?

the have of source for Example?

Sample source is attached.

GM_Error_t32 theErr = GM_Error_None;

// Load the file
GM_LayerHandle_t32* theLayerHandleList = NULL;
uint32 theNumLayersLoaded = 0;
GM_LoadFlags_t32 aLoadFlags = GM_LoadFlags_HideProgress | GM_LoadFlags_UseDefaultProj;

theErr = GM_LoadLayerList (
mFile, &theLayerHandleList, &theNumLayersLoaded, aLoadFlags

if ( theErr != GM_Error_None )
AfxMessageBox("GM_LoadLayerList Error!!!");

GM_LayerHandle_t32 theLayerHandle = theLayerHandleList[0];

const GM_LayerInfo_t* theLayerInfo = GM_GetLayerInfo( theLayerHandle );
GM_Projection_t m_ProjFile;
::memset( &m_ProjFile, 0, sizeof m_ProjFile );

char* prj = "C:\\Bessel50_Center.prj";

GM_LoadProjectionFile( prj , &m_ProjFile);

Prj Files



  • global_mapper
    global_mapper Administrator
    edited June 2012
    I'm guessing that you want to provide the projection for the layer as one of those PRJ files? If so you can either use GM_SetQueryProjectionCallback to provide a callback function to be used when asking the user for the projection and load it there, or just call GM_LoadRectifierLayer and pass in the projection structure (use NULL for the control point list to use the built-in position) to use that as the projection.


    Global Mapper Guru
  • gugupo
    gugupo Global Mapper User Trusted User
    edited June 2012
    Thanks Mike.

    Another question

    How to replace the projection to "Bessel50_Center.prj and "GRS80_50_Center.prj" ?
  • global_mapper
    global_mapper Administrator
    edited June 2012
    What exactly do you mean by 'replace'? If you want to set the view/export projection to one of those use GM_LoadProjectionFile to load the projection into a GM_Projection_t definition structure, then use GM_SetProjection to set the projection to what was loaded from the .prj file.


    Global Mapper Guru