Map Projection Doom and Gloom [message #66634] |
Sat, 30 May 2009 09:22  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
I have spent nearly three days this week (not to mention
a beautiful weekend morning when I expected to be out
listening to Meadow Larks and learning native plant species)
entombed in map projection chaos and despair.
I have written about this before:
http://www.dfanning.com/map_tips/ephemeral.html
but it bears repeating. Especially so when it is so
damn easy to ignore good advice and proceed as if the
world were a friendly and reasonable place. I assure
you, it is not. :-(
Here is the crux of my advice: If you are going to use
a map structure for *ANYTHING* (and I really do mean
*ANYTHING*!!), then be absolutely sure you execute
the MAP_PROJ_INIT command *IMMEDIATELY* prior to using
the friggin' thing!
If anyone wants the details, I would be happy to provide
them, but I have been advised by my doctor to wait until
my blood pressure gets back under 200 before I do so. :-(
Cheers,
David
P.S. Let's just say what with all the wailing and gnashing of teeth
this week, I have a much better understanding of what some people
mean by the expression "hell on Earth".
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Map Projection Doom and Gloom [message #66672 is a reply to message #66634] |
Fri, 05 June 2009 08:40  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> Here is the crux of my advice: If you are going to use
> a map structure for *ANYTHING* (and I really do mean
> *ANYTHING*!!), then be absolutely sure you execute
> the MAP_PROJ_INIT command *IMMEDIATELY* prior to using
> the friggin' thing!
Just to follow up on this. I've heard from someone who
understands exactly what is going on here. It seems that
the underlying GTCP software that IDL relies on for it's
map projections uses static variables (explained to me as
"equivalent to evil common blocks") to hold various parameters.
(If you look in the MAP_PROJ_INIT source code, you will
see that the ITTVIS programmer puts a helpful note in the code
that the user is calling the GCTP software "at your peril".
Not the kind of thing you really like to see in software
comments.)
So, while the *structure* returned from MAP_PROJ_INIT
doesn't actually change when another MAP_PROJ_INIT call is
made, the underlying data stored in these static variables
*does* change. This is what causes the Great Disconnect
as you compare an unchanged map structure with wacky output.
It is unclear if this is an IDL problem or a GCTP problem.
ENVI, I note, has given up on GCTP completely and is going
(really *unfortunately*, IMHO) to an ESRI map projection engine.
It would have been SO much better if they just moved all this
map projection stuff to a proj.4 Open Software project. (The
ESRI engine uses *some* of the proj.4 stuff, but not all of it
for some reason.)
There is no indication at all that IDL's map projection
software will change any time soon, no matter what ENVI
does. So I wouldn't hold my breath that this will be fixed
in our life times. :-)
Cheers,
David
|
|
|