Elevation Grid Export / View In-Memory
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
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
-
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 -
Awesome - will check out, thanks.
Brian -
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 -
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 -
Mike,
Thanks - are the box averagers an implementation of Lagrange multipliers?
Brian -
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
Categories
- 12.5K All Categories
- 5.5K Features Discussion
- 314 Downloading Imagery
- 1.3K Elevation Data
- 377 Georeferencing Imagery Discussion
- 611 GM Script Language
- 50 User Scripts
- 112 GPS Features
- 397 Projection Questions
- 803 Raster Data
- 1.3K Vector Data
- 6.5K Support
- 161 Announcement and News
- 893 Bug Report
- 557 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 542 Other Discussion
- 128 GIS Data Sources
- 26 Global Mapper Showcase
- 229 How I use Global Mapper
- 104 Global Mapper Forum Website