changing global projection
rick_edwards
Global Mapper User
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
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
-
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 -
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 -
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 -
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.
-
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
Rickglobal_mapper wrote: »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 -
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
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website