Folks,
Does anyone have a discount coupon for MatLab? I've nearly
had it with IDL, and it's only Wednesday. I may not make
it to Friday.
I spent the better part of the day absolutely confused
about map projections. That in itself is not unusual,
map projections are pretty hard, but I've been thinking
recently that I've been getting my head around the darn
things pretty well.
But then I started working on a new project today and I
kept seeing something that looked like some kind of
spooky action at a distance, and I got totally freaked out.
*Finally* I remembered that I had seen this once before,
and I tracked it down to a May 2007 article in this
newsgroup.
It turns out MAP_PROJ_INIT is a one-way street. You can
use it to create a map structure, and you can use that
map structure to do things with maps. But when you make
a *second* map structure, you lose all ability to do anything
useful with the first map structure. You can't go home again.
Here is a short program that demonstrates the problem.
PRO MapProjInit_Bug
; Here is the map projection I want to set up.
Window, XSIZE=350, YSIZE=350, XPOS=0, YPOS=0, TITLE='What I expect'
mapStruct = Map_Proj_Init(111, /GCTP, DATUM=8, CENTER_LATITUDE=90, $
CENTER_LONGITUDE=0, LIMIT=[0, -180, 90, 180])
plot, mapStruct.uv_box[[0,2]], $
mapStruct.uv_box[[1,3]], $
/NoData, XSTYLE=5, YSTYLE=5
Map_Continents, MAP_STRUCTURE=mapStruct, /FILL
; I create another map projection. Rotated in this case.
; But I don't even save the map structure! I map the continents
; again and it uses the 2nd map projection. Huh!?
Print, Ptr_New(Map_Proj_Init(111, /GCTP, DATUM=8, CENTER_LATITUDE=90, $
CENTER_LONGITUDE=135, LIMIT=[0, -180, 90, 180]))
window, 1, XSIZE=350, YSIZE=350, XPOS=375, YPOS=0, $
TITLE='What happened!!'
Map_Continents, MAP_STRUCTURE=mapStruct, /FILL
END
Guess I'll write this up. I can't afford to waste 5 hours every
time I try to do something useful with map projections. :-(
Cheers,
David
--
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.")
|