Global Mapper v25.0

Custom Grid creation/export

ikabott
ikabott Global Mapper UserTrusted User
edited December 2009 in SDK
Hi once again, Mike

I want now to create a grid of custome (Int16) values. I use the following functions (incomplete code):
GM_Point_t aPoint = new GM_Point_t();
aPoint.mX = 84005;
aPoint.mY = 447995;

gridHandler = GlobalMapperDLL.GM_CreateCustomElevGridLayer("sampleGrid", ref aProj, ref aPoint, 10, 10, 100, 100, ptr, GlobalMapperDLL.GM_GridLayout_t8.GM_GridLayout_SInt16, 0);


GlobalMapperDLLWrapper.GM_Rectangle_t CurrentViewRect = new GlobalMapperDLLWrapper.GM_Rectangle_t();
CurrentViewRect.mMaxX = 85000;
CurrentViewRect.mMinX = 84000;
CurrentViewRect.mMaxY = 448000;
CurrentViewRect.mMinY = 447000;

LastGMError = GlobalMapperDLL.GM_ExportElevation(outputPath + "sampleGrid.xyz", GlobalMapperDLL.GM_ElevationExportFormat_t32.GM_Export_XYZ_ASCII_Grid, gridHandler, ref CurrentViewRect, (int)100, (int)100, 0, GlobalMapperDLL.GM_ElevUnits_t8.GM_ElevUnit_Meters);

I use Dutch projection system (in meters) and I want a 10mx10m cells. The total grid will be 1kmx1km so 100x100 samples.

My imput data is a sample 1,2,3,4, ... The problem is that when I export to XYZ. The result looks like this:
84000.000,447989.899,1.000
84000.000,447979.798,1.520
84000.000,447969.697,2.530
84000.000,447959.596,3.540
84000.000,447949.495,4.551
84000.000,447939.394,5.561
84000.000,447929.293,6.571
84000.000,447919.192,7.581
84000.000,447909.091,8.591
84000.000,447898.990,9.601
...[second grid line]
84010.101,448000.000,1.000
84010.101,447989.899,1.260
84010.101,447979.798,2.030
84010.101,447969.697,3.040
84010.101,447959.596,4.051
84010.101,447949.495,5.061
84010.101,447939.394,6.071
84010.101,447929.293,7.081
84010.101,447919.192,8.091
84010.101,447909.091,9.101
84010.101,447898.990,10.111

Every grid cell represent a classification, so it cannot be rounded or modified. Does it has to do with the extent of the export? How can I have more control over my data?

Thanks in advanced
Oscar

Comments

  • global_mapper
    global_mapper Administrator
    edited December 2009
    Oscar,

    I think the problem is that your "elevation" data is being inteporlated when an export sample location is not at a grid cell center. Interpolation is enabled by default for elevation layers, but you can disable it by calling the GM_SetRasterDisplayOptions function for a layer and turning off the mInterpolatePixels member of the GM_RasterDisplayOptions_t structure. I would suggest calling GM_GetRasterDisplayOptions for the layer first to initialize the structure, then turn off interpolation and call GM_SetRasterDisplayOptions.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com