Re: Display and Navigate Image in IDL 8.2 [message #81346 is a reply to message #81342] |
Wed, 05 September 2012 07:02   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
I have learned a little more about this problem this
morning. It's all complicated when nothing shows up
in your graphics window! ;-)
Let me go through it again.
Here is the code that obtains a map projected image:
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 details about the image (note Google uses
a center latitude and longitude of 0 to calculate the
map ranges):
projection = "mercator"
ellipsoid = "WGS84"
centerLat = 0.0
centerLon = 0.0
limit = [-84.7500, -180.000, 84.7500, 180.000]
xrange = [-11711131.0D, -11688226.0D]
yrange = [4914254.0D, 4937159.5D]
Here is the code that gives me a blank window and which I am
trying to fix:
obj = Image(googleImage, MAP_PROJECTION=projection, $
ELLIPSOID=ellipsoid, GRID_UNITS=1, $
CENTER_LONGITUDE=centerLon, CENTER_LATITUDE=centerLat, $
LIMIT=limit, XRANGE=xrange, YRANGE=xrange, $
DIMENSIONS=[700,700], LOCATION=[50,50], /BOX_AXES)
Here is Coyote Graphics code that results in what I expect to see:
cgDisplay, 700, 700
map = obj_new('cgMap', projection, ELLIPSOID=ellipsoid, $
CENTER_LONGITUDE=centerLon, CENTER_LATITUDE=centerLat, $
LIMIT=limit, XRANGE=xrange, YRANGE=yrange)
cgImage, googleImage, Margin=1.0, OPosition=pos
map -> SetProperty, POSITION=pos
cgMap_Grid, /Box_Axes, MAP=map
And here is a PNG file of what I am trying to see in Function
Graphics:
http://www.idlcoyote.com/misc/googlemap.png
I've been working on this for hours, so any help at all gratefully
accepted. :-)
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.")
|
|
|