# Project and Deproject point problem

Osei
Global Mapper UserPosts:

**119**Trusted User
Merry christmas and a happy new year.

I have a slight problem that has entangled my mind. I am using 1.29 of the SDK.

I have a point [x,y] = [336000,651000]

I project the point from UTM Zone 30 to UTM Zone 36. f

f([x,y]) = [-3970893.963,819098.648]

This is the same value I get when I do the projection on the point in the Global Mapper Application (GM9).

However, when I project the point back from UTM Zone 36 to UTM Zone 30, I get

f-Inverse(f[x,y]) = [332712.461,649096.716]

I was hoping to get back [x,y] (ie [336000,651000]) but I get a different value (the one above).

Am I wrong to hope for the same value or is there something I am getting wrong? In GM9, I get back the original coordinates.

Thanks in advance for your time and effort. Once again, best wishes for the season.

I have a slight problem that has entangled my mind. I am using 1.29 of the SDK.

I have a point [x,y] = [336000,651000]

I project the point from UTM Zone 30 to UTM Zone 36. f

f([x,y]) = [-3970893.963,819098.648]

This is the same value I get when I do the projection on the point in the Global Mapper Application (GM9).

However, when I project the point back from UTM Zone 36 to UTM Zone 30, I get

f-Inverse(f[x,y]) = [332712.461,649096.716]

I was hoping to get back [x,y] (ie [336000,651000]) but I get a different value (the one above).

Am I wrong to hope for the same value or is there something I am getting wrong? In GM9, I get back the original coordinates.

Thanks in advance for your time and effort. Once again, best wishes for the season.

## Comments

119Trusted Userprivate bool ProjectPoint(ref double x, ref double y)

{

GM_Projection_t lambert = new GM_Projection_t();

lambert.ProjSys = PROJSYS.GM_PRJ_UTM;

lambert.Unit = UNIT.GM_PRJ_UNIT_METERS;

lambert.Datum = DATUM.GM_DATUM_WGS_84;

lambert.NumAttrs = 1;

lambert.Attr1.mAttr = PROJATTR.ZONE;

lambert.Attr1.mValue = 36;

/*lambert.ProjSys = PROJSYS.GM_PRJ_LAMBERT_II;

lambert.Datum = DATUM.GM_DATUM_NTF_FRANCE_PARIS;

lambert.Unit = UNIT.GM_PRJ_UNIT_METERS;

//lambert.NumAttrs = 6;

*/

GM_Projection_t utm = new GM_Projection_t();

utm.ProjSys = PROJSYS.GM_PRJ_UTM;

utm.Unit = UNIT.GM_PRJ_UNIT_METERS;

utm.Datum = DATUM.GM_DATUM_WGS_84;

utm.NumAttrs = 1;

utm.Attr1.mAttr = PROJATTR.ZONE;

utm.Attr1.mValue = 30;

IntPtr ipLambert = Marshal.AllocCoTaskMem(Marshal.SizeOf(lambert));

Marshal.StructureToPtr(lambert, ipLambert, false);

IntPtr ipUTM = Marshal.AllocCoTaskMem(Marshal.SizeOf(utm));

Marshal.StructureToPtr(utm, ipUTM, false);

bool result;

if (checkBox1.Checked)

{

result = (GlobalMapperDLL.GM_Error_t32.GM_Error_None == GlobalMapperDLL.GM_ProjectPoint(x, y, out x, out y, ipUTM, ipLambert));

}

else

{

result= (GlobalMapperDLL.GM_Error_t32.GM_Error_None == GlobalMapperDLL.GM_ProjectPoint(x, y, out x, out y, ipLambert, ipUTM));

}

Marshal.FreeCoTaskMem(ipLambert);

Marshal.FreeCoTaskMem(ipUTM);

if(!result)

MessageBox.Show("Could not perform projection");

return result;

}

17,238Let me know if I can be of further assistance.

Thanks,

Mike

Global Mapper Support

support@globalmapper.com

119Trusted UserThanks in adavnce for your help.

17,238In Global Mapper coordinate are always kept in the native coordinate system specified for a data set, then reprojected on the fly as needed for display and such. That way there is not a problem with a loss of precision as different projection systems are used as the original coordinates in the native coordinate system are always maintained and used for any later conversions.

Let me know if I can be of further assistance.

Thanks,

Mike

Global Mapper Support

support@globalmapper.com

119Trusted User