comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Navigating AVIRIS Images
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Navigating AVIRIS Images [message #85590 is a reply to message #85584] Tue, 20 August 2013 12:29 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Scott Ozog writes:

> Hi I'm still new to IDL, and I'm trying to learn it for grad school. I'm trying to navigate images from NASA's AVIRIS platform. If anyone has experience in this it would be greatly appreciated.
> I have a file that has Lons in band 1, Lats in band 2, and a elevation model image in band 3.
> The arrays are [677, 3068] and the resolution of each pixel is unknown. The image is in UTM using WGS84.
>
> The actual image file is larger in both sample and lines, but I'm at least trying to learn how the MAP_PATCH or Fanning's WarpToImage procedures work. I still can't quite get them to work yet with my image.

I wouldn't waste too much time with cgWarpToMap. I am THIS close to the
IDL Holy Grail and I've got cgWarpToMap all torn apart right now. I've
been searching for 10 years to find a fast way to convert a MODIS swath
file to a navigable image and I am very, very close. (In fact, I woke up
at 2AM and worked on it last night, when I had a new idea.)

If this image is already projected, though, as you indicate, I doubt
very much that you will need to bother with either Map_Patch or
cgWarpToMap. Rather, you will need the UTM zone number, which you can
obtain from cgUTMZone by passing in any lat/lon pair you have laying
around in your lats and lons arrays.

zone = cgUTMZone(lon[0,0], lat[0,0])

Then, you need a map object:

map = Obj_New('cgMap', 'UTM', ELLIPSOID='WGS84', Zone=zone)

Make sure the longitudes are in the range -180 to 180.

lons = ((lons + 180) MOD 360) - 180

Convert these values to XY projected meter space:

xy = map -> Forward(lons, lats)

Find the min and max of the X and Y space:

x = Reform(xy[0,*])
y = Reform(xy[1,*])
xmin = Min(x, MAX=xmax)
ymin = Min(y, MAX=ymax)

Find the size of your image:

s = Size(image, /Dimensions)

Calculate the X and Y scales:

scale_x = (xmax - xmin) / (s[0]-1)
scale_y = (ymax - ymin) / (s[1]-1)

Calculate the XY ranges and set the map object appropriately:

rect = [xmin-(scale_x/2.), ymin-(scale_y/2.), $
xmax+(scale_x/2.), ymax+(scale_y/2.)]
xrange = rect[[0,2]]
yrange = rect[[1,3]]
map -> SetProperty, XRANGE=xrange, YRANGE=yrange

Display your image and navigate it.

cgDisplay, Aspect=image, 800, 800
cgImage, image
cgMap_Continents, Map=map, Color='red6'
cgMap_Grid, Map=map, Color='blu6'

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Adding extra white in middle of colour bar
Next Topic: Call object cleanup method when IDL exits

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 12:52:22 PDT 2025

Total time taken to generate the page: 0.72015 seconds