Elevation Grid Export / View In-Memory

codemousecodemouse Global Mapper UserPosts: 186Trusted User
edited September 2013 in SDK
Mike,

I think I may have asked this before but is there any way to view an XYZ grid (similar to the results of what you would get on an XYZ Grid Export for a certain bounds and flags) IN memory in the SDK? Or does an export always require writing to a file? I'm not looking for it in any format other than plain text. Thoughts?

Brian

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited September 2013
    Brian,

    You can spin through the samples in a grid using GM_GetPixelElevation (or GM_GetPixelElevationRow for faster access to chunks) and format them however you want. Use GM_ConvertCoordLayerPixelToGround to get the ground coordinates associated with the pixel coordinates relative to a particular layer to get the XY part.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • codemousecodemouse Global Mapper User Posts: 186Trusted User
    edited September 2013
    Awesome - will check out, thanks.

    Brian
  • codemousecodemouse Global Mapper User Posts: 186Trusted User
    edited September 2013
    Mike,

    Well you probably guessed where my next question was heading -

    I am now looking at various methodologies for interpolation between gridded points (I want a value at pixel 100.5, not 100 or 101). Can you elaborate on methodologies on how you currently do this for grid exports? I am looking at nearest-neighbor type solutions using a handful of ideas. Any tips?

    Brian
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited September 2013
    Brian,

    There are a number of resampling methods that you can use in Global Mapper, like bilinear or bicubic interpolation, or a box average/min/max. The interpolation is best for sampling around or better than the native resolution of the lower. The different size box averagers are better for sub-sampling.

    Rather than write your own, you can use GM_GetLocationElevation to query an elevation layer at a ground location which could be somewhere other than the grid cell center, then the sampling method in place for the layer (use GM_SetRasterDisplayOptions to set, default is bilinear interpolation for grids) will be used.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • codemousecodemouse Global Mapper User Posts: 186Trusted User
    edited September 2013
    Mike,

    Thanks - are the box averagers an implementation of Lagrange multipliers?

    Brian
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited September 2013
    Brian,

    No the box averagers are just a simple look in a nxn box around the sample and average the values. For example with a 3x3 box averager the value you would get out for a sample inside sample (1,1) would be the average of the 9 pixels centered on (1,1), from (0,0) to (2,2).

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
Sign In or Register to comment.