Arc ASCII Grid Export header
Comments
-
This makes sense.
So my global rectangle is:
mMaxX = -30.000131102362204
mMaxY = 59.999868897637796
mMinX = -29.966568897637796
mMinY = 60.0334311023622
The original ascii file layer sample spacing was 2 minutes (let's just say). So I'm lost - shrink it by 1 minute on each coord? That won't work, I'll be down to a single point in THIS instance.
Brian -
You just need to take the global rectangle width divided by the global pixel width (and the same for the height) to get the sample spacing in the current projection system.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
If your original sample spacing was 2 minutes, then you would shrink the bounding box by 1 minute in each coordinate. Don't use mPixelSizeX and mPixelSizeY as that is an estimate of the pixel size in meters and you need the pixel size in the current projection units, which is arc degrees in this case.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
This, for width/height of ExportElevation is not working so nicely:
var globalRectangleWidth = _asciiLayerInfo.mGlobalRect.mMaxX - _asciiLayerInfo.mGlobalRect.mMinX;
var globalRectangleHeight = _asciiLayerInfo.mGlobalRect.mMaxY - _asciiLayerInfo.mGlobalRect.mMinY;
var widthSampleSpacing = globalRectangleWidth / _asciiLayerInfo.mGlobalPixelWidth;
var heightSampleSpacing = globalRectangleHeight / _asciiLayerInfo.mGlobalPixelHeight;
var pixelWidth = (int)(_asciiLayerInfo.mGlobalPixelWidth - (widthSampleSpacing / 2));
var pixelHeight = (int)(_asciiLayerInfo.mGlobalPixelHeight - (heightSampleSpacing / 2)); -
Your sample spacing calculations are correct, but you are adjusting the wrong thing at the end. You need to adjust your bounding rectangle that you pass in by one half the sample spacing, not the pixel dimensions. So your new mMinX would be ( _asciiLayerInfo.mGlobalRect.mMinX + widthSampleSpacing / 2.0 ). Do the same for the other rectangle values.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
pixelWidth/Height can stay as var pixelWidth = (int)_asciiLayerInfo.mGlobalPixelWidth ? etc... ?
-
Yes, don't change anything but the bounding rectangle that you are providing.
-
Bingo... this worked - except one thing NCOLS is still showing up as 129 instead of 128. Thoughts?
globalRectangle.mMaxX -= widthSampleSpacing / 2;
globalRectangle.mMinX += widthSampleSpacing / 2;
globalRectangle.mMaxY -= heightSampleSpacing / 2;
globalRectangle.mMinY += heightSampleSpacing / 2; -
In the GUI version with 128 cols, the last column is (-9999)
In the programmatic version with 129 cols, the last TWO columns are (-9999 -9999) -
I took a look and found that in the GUI the pixel count was always rounded to the nearest whole number (as it should be), while in the SDK it was always rounded up. I have updated the SDK to round to the nearest number like the GUI and placed a new build at http://www.globalmapper.com/GlobalMapperSDK_v134_beta.zip for you to try.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Magnifique!
This works nicely. Thank you. I will be testing this out more tomorrow, but this is looking just about right at this point. I find it amusing in the programmatic version I gain an extra decimal place on cellsize, but it's pretty trivial:
SDK
cellsize 0.00026220472440943
GUI
cellsize 0.0002622047244094
Just thought I'd mention.
Thank you for your help on this. This was very beneficial for what we are doing!
Brian -
Mike,
In newer versions of the SDK I am receiving inconsistent behavior with GM_ExportFlags_ForceSquareSamples - I'm going to try to dig up the older version of the SDK I have lying around (from 9/2010) to see if the issue goes away. Do you know if the force square option broke on later versions when utilizing via GM_ExportElevation?
Brian -
Mike,
GM_ExportFlags_ForceSquareSamples works in a version of an SDK I have dated 10/9/2010 12:21pm - version 1.34.0.0 - but it doesn't seem like the logic for this ever integrated into future SDK builds and/or it seems to possibly have the issue where it will run sometimes but not others (look back in this thread). Can you confirm? I cannot seem to get it really work in newer SDK versions at all.
If you cannot make a fix - can I ask if you have an older SDK version binary available? I have a copy of the 32-bit binaries but I'm lacking the 64-bit from this build I'm referencing.
Brian -
Brian,
I took a look and indeed the force square pixels option wasn't being done properly for elevation exports. I've fixed this and placed a new build at http://www.globalmapper.com/GlobalMapperSDK_v15_latest_beta.zip so it should work properly for you now.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Global Mapper -
Mike - thanks!
Brian
Categories
- 12.9K All Categories
- 5.7K Features Discussion
- 346 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 643 GM Script Language
- 54 User Scripts
- 115 GPS Features
- 419 Projection Questions
- 829 Raster Data
- 1.4K Vector Data
- 6.6K Support
- 180 Announcement and News
- 926 Bug Report
- 561 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 574 Other Discussion
- 132 GIS Data Sources
- 27 Global Mapper Showcase
- 241 How I use Global Mapper
- 108 Global Mapper Forum Website