Global Mapper v25.0

changing global projection

rick_edwards
rick_edwards Global Mapper User
edited January 2010 in SDK
hi all,

I have a slight issue when changing the global projection for many layers when a layer is not being displayed by GM after the projection change. In our case if we go from a British grid to ca. UTM40 then our digital terrain model layer (elevation raster) is not displayed. Now I need to be able to check for the successful change in projection for all layers else show the user some kind of message to say that we're unable to display some layer.

I'm currently struggling to find any feedback from GM that I can hook into. I've tried to reproject the map extent first to see if it fails but no luck so I've tried checking the extent for each layer after projection change to see if that gives any indication but again no luck.

Any ideas or advice would be gratefully received.

Rick

Comments

  • global_mapper
    global_mapper Administrator
    edited January 2010
    Rick,

    What I would suggest doing is checking the mGlobalRect value of the layer info structure of each layer after reprojecting to see if any are empty. Another approach would be to go through each layer and call GM_ProjectRectangle on the mNativeRect of the layer info and see if you get an error when trying to project the original layer rectangle to the new projection.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • rick_edwards
    rick_edwards Global Mapper User
    edited January 2010
    Hi Mike,

    we've tried both approaches without success, when I talk about extent I really mean the mapping rectangle. We don't see any error when re-projecting the native rectangle and if we iterate over the layers and check the extent width and height after projection we don't see any blank or zero numbers.

    So any other ideas?

    Cheers

    Rick
  • global_mapper
    global_mapper Administrator
    edited January 2010
    Rick,

    What are the values in the mNativeRect and mGlobalRect layer information structures for a layer that doesn't show up after reprojection? I'm wondering if perhaps the layer that doesn't show was outside of the prime area for the new projection and now has wild coordinate values.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • robinsonsmith
    robinsonsmith Global Mapper User
    edited January 2010
    I have always thought it a little arrogant of us to assume that human activity can have a more dramatic affect on the planet than the sun, geology and the rest of the animal kingdom put together.
  • rick_edwards
    rick_edwards Global Mapper User
    edited January 2010
    Hi Mike,

    the workaround we've implemented is to first project a point to the new selected UTM zone projection and then re-project it back to the original projection and look at the shift in coordinates. If the shift is above ca. 50 metres then we know the projection is probably wrong and we warn the user they are trying to project to a nonsensical projection. At least we can catch the user before they try and do something we deem to be wrong.

    Regards

    Rick

    Rick,

    What are the values in the mNativeRect and mGlobalRect layer information structures for a layer that doesn't show up after reprojection? I'm wondering if perhaps the layer that doesn't show was outside of the prime area for the new projection and now has wild coordinate values.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • global_mapper
    global_mapper Administrator
    edited January 2010
    Rick,

    Ah, that is a good thing to check as when you get far from a UTM zone center (or any Transverse-Mercator-based projection center) the projection math starts becoming very non-reversible, so you'll get very different results back than what you put in if you go to lat/lon and back (or vice-versa). Or you might just check and see if a UTM zone is selected whose center is more than about 10 degrees from your data and warn then.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com