Display and Navigate Image in IDL 8.2 [message #81350] |
Tue, 04 September 2012 13:53  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
Here is code that will obtain an image from Google as a PNG file
and put it into the variable "googleImage":
googleStr = "http://maps.googleapis.com/maps/api/staticmap?" + $
"center=40.6000,-105.1000&zoom=12&size=600x600" + $
"&maptype=terrain&sensor=false&format=png32"
netObject = Obj_New('IDLnetURL')
void = netObject -> Get(URL=googleStr, FILENAME="googleimg.png")
Obj_Destroy, netObject
googleImage = Read_Image('googleimg.png')
Here are the map details about this image.
Map Projection: "Mercator"
Map Ellipsoid: WGS-84
Center_Latitude: 40.6000
Center_Longitude: -105.1000
Map Limit: [-84.7500, -180.000, 84.7500, 180.000]
XRange: [-11711131.0, -11688226.0] (meters)
YRange: [4914254.0, 4937159.5] (meters)
Meters/pixel: 38.1757
Image Dimensions: [600,600]
I wish to display this image and have the cursor update properly
in map space (latitude and longitude) as I move the cursor over it.
I am required to do this with the IDL 8.2 function graphics commands.
I can get the image to display with this command.
obj = Image(googleImage, /BOX_AXES, $
map_projection='mercator', ellipsoid='WGS84', $
Center_Latitude=centerLat, Center_Longitude=centerLon, $
LIMIT=limit, XRANGE=xrange, YRANGE=yrange, GRID_UNITS=1, $
DIMENSIONS=[700,700], LOCATION=[50,50])
But, as you can see, no box axes and what map labels there are
on the image are completely wrong. :-(
Even more interesting, if I execute this exact same command
from within a widget program that obtains the Google image,
I get the properly sized image window to appear, but it is
completely and utterly blank! Nothing in it whatsoever!
(I've proved the image actually exists at this point in the
widget program by displaying it normally with cgImage.)
Any ideas on where to go from here? It doesn't appear to me that
*any* of my map projection information is being recognized. I
have NO idea why identical commands work from the IDL command line
but not from within a widget program.
Cheers,
David
P.S. Let's just say Function Graphics are *still* completely and utterly
baffling to me!
--
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.")
|
|
|