Global Mapper v25.0

GM_ExportElevationEx - determine elevation pixels in bounds before export

codemouse
codemouse Global Mapper UserTrusted User
edited April 2012 in SDK
Mike,

In GM_ExportElevationEx - is there any way to determine how many elevation points exist within a certain world bounds prior to export? I ask because you have to specify a pixel width/height for export ahead of the the actual export, but of course if you change the export bounds to be something outside of the entire layer you really have no idea which elevation points may exist in there to actually specify for export. Any thoughts on this? Is there some "auto - based on elevation points that exist" setting and/or a way for me to count the x/y elevation points within a particular world bounds / rectangle prior to export? Thanks.

Brian

Comments

  • codemouse
    codemouse Global Mapper User Trusted User
    edited April 2012
    Mike,

    It looks like LayerInfo GM_AttrValue_t* mMetadataList; // List of metadata attributes and values for the layerHas what I would need. Trying to marshall it into something managed code can see. Can you confirm this is right?

    Brian
  • global_mapper
    global_mapper Administrator
    edited April 2012
    Brian,

    That list of values wouldn't contain what you are after. I would instead intersect your export bounds with the GM_LayerInfo_t.mGlobalBounds to figure out what overlap there is between an input layer and your total export bounds, then based on the pixel dimensions of that layer (which tells you the total number of samples) you can calculate an actual approximate number in your export bounds based on the percent of the layer in your export bounds. I think what you really might want is a way to determine a sample size to use for computing appropriate pixel height and width through, correct?

    You could use the same approach for that, just spin through the GM_LayerInfo_t structures for loading layers and calculate sample spacing in the current projection using the mGlobalBounds and the pixel dimensions, then use the smallest of those from the intersecting layers to compute an output pixel width/height for your export bounds that maintains the full resolution.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • codemouse
    codemouse Global Mapper User Trusted User
    edited April 2012
    Mike,

    Yes - I just figured all that part out. So - is there a way, given a pre-set world bounds I can draw/select an AOI and then load it as a new layer to get all associated new layer info?

    Brian
  • codemouse
    codemouse Global Mapper User Trusted User
    edited April 2012
    Mike,

    Or are you saying something like this. If my total world bounds has 117 pixels/samples across (elevation grid), for example, and I want to slice that up into 8 "even" grids", I of course can do this via lat/lon UTM with no issues. But the 117/8 would be 14.625 and obviously we need whole numbers here between grids. Would you suggest to just leave the grid division at 14 OR 15 at that rate? Again, I understand what you are saying in terms of approximation. I'm just curious suggestions, thanks.

    Brian
  • global_mapper
    global_mapper Administrator
    edited April 2012
    I guess I'm not sure what you mean by loading the AOI as a new layer? Are you wanting to just load some data that is in that particular AOI or something different?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • global_mapper
    global_mapper Administrator
    edited April 2012
    I would round up that way you get slightly higher rather than slightly lower resolution, so you don't lose anything.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • codemouse
    codemouse Global Mapper User Trusted User
    edited April 2012
    Mike,

    Yea - I noticed that somewhat already. Thanks for the info.

    Brian