Re: Display and Navigate Image in IDL 8.2 [message #81313 is a reply to message #81312] |
Fri, 07 September 2012 07:03   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Alain writes:
> Here is my solution:
I'm feeling generous this morning, Alain, so I'll let you get
away with the word "solution". At least for now. ;-)
> 1st step: define the size of the image in decimal degrees, by using your "magic" resolution number. I guess that it might be retrieved by another way.
> centerlat = 40.6000d
> centerlon = -105.1000d
> res = 38.1757
> map = Map_Proj_Init('mercator', /gctp, ELLIPSOID='wgs 84')
> cm = map_proj_forward(centerlon, centerlat, MAP=map)
> xrange = cm[0] + [-300,300]*res
> yrange = cm[1] + [-300,300]*res
> xr = map_proj_inverse(xrange, yrange, MAP=map)
> print,xr
> ; -105.20288 40.521535
> ; -104.99712 40.678372
> As you can see, numbers are slightly different from yours (in latitude).
There are a couple of problems with this approach (other
than it doesn't do exactly what I want). First, I have to
get Map_Proj_Init involved, which the Map function is
suppose to handle for me. I already know how to use Map_Proj_Init
and believe me, you don't want to go through these contortions
to use it! I use Map_Proj_Init (via cgMap, but it is a direct
wrapper for it) in my Coyote Graphics solution. It works perfectly
to navigate this image with the input data I have provided. This
image is gridded in projected meter space, and Map_Proj_Init can
work in projected meter space perfectly.
The second (and, I suspect, more fundamental) problem is that your
solution requires me to work in lat/lon space rather than projected
meter space. While it is true that I can work in this space with the
Map function, and I can actually see my image with map annotations
around it, the image is distorted because it has been warped into this
map space. The distortion is only slight in this Mercator projection
and over this map range, but if you look carefully at this image and
the one created with the Coyote Graphics solution you can easily
see the difference. The Google text, in particular, shows the obvious
distortions.
Now, IDL has always had a bias toward warping the image to fit
the map projection (I am approaching a dozen years of harping
about this to them!) and working in lat/lon space. But, this is
NOT the space the remote sensing community that I work with
wants to work in. It makes no sense! It's like working in one
of those fun-house rooms without a square corner. You get queasy
just being in there! Every GeoTiff file in the world (I guess there
are a few exceptions) works in projected meter space. Every satellite
image on my computer works in projected meter space. I DON'T
WANT TO WORK IN LAT/LON SPACE!!!
So, here is the problem with the friggin' function graphics
system.
I can display an image. And I can set up a proper map
projection with the Map_Proj_* routines. I just can't
use the two together in a graphics window!
Does this strike you, as it does me, as ludicrous?
Surely you and I and everyone else are missing the
obvious solution. Is it possible that the function
graphics system is not meant to be used by professional
programmers?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|