If you've ever tried to display a large (say 1000x1000 pixel) satellite image on a base map in IDL, then you've probably been frustrated at the lack of an easy-to-use tool. I spent many hours playing with TRIANGULATE, TRIGRID, POLY_2D, and POLYWARP, and never found a satisfactory solution (let me know if you do!).
Hermann Mannstein suggested a solution in response to a question I posted to the IDL newsgroup. First, MAP_SET is used to define a map projection in the current display window. CONVERT_COORD is then used to copy pixel values from the input image to the corresponding location on the map projection. Finally DILATE is used to fill any holes in the resampled image.
The results turn out quite well, considering the simplicity of the algorithm. Remember, I'm talking about a display tool here, not a robust resampling. Some examples for different sensors are shown below.
Usage Tips
device,pseudo=8,retain=2,decomposed=0On Windows and Macintosh boxes, you will need to configure the system outside of IDL to use an 8 bit (256 color) display.This is worth doing anyway, in order to get color tables to work reasonably in IDL (most IDL programs work best on 256 color displays).
imagemap,image,lat,lonThen customize the result using the keywords (e.g. RANGE, MISSING).
; HIRS channel 20 reflectance (0.0-1.0) and corresponding lat/lons
help,image,lat,lon
IMAGE FLOAT = Array(56, 40)
LAT FLOAT = Array(56, 40)
LON FLOAT = Array(56, 40)
imagemap,image,lat,lon,range=[0.0,1.0],$
title='HIRS Channel 20 - Unresampled'
map_continents,/hires ; Bad result
; Now resample the arrays to 10 times their normal size
sz=size(image) & nx=sz(1) & ny=sz(2) & mag=10
imagemap,congrid(image,mag*nx,mag*ny),$
congrid(lat,mag*nx,mag*ny,/interp),$
congrid(lon,mag*nx,mag*ny,/interp),$ range=[0.0,1.0],$
title='HIRS Channel 20 - Resampled'
map_continents,/hires ; Good result
device=!d.name & tvlct,r,g,b,/get
set_plot,'PS',/interp
device,/land,/helv,font_size=8,bits=8,/color,file='imagemap.ps' & !p.font=0
imagemap,image,lat,lon,missing=255
device,/close & set_plot,device & tvlct,r,g,b & !p.font=-1
;- Make images the first time
!p.multi=[0,1,2,0,0]
imagemap,image1,lat1,lon1
imagemap,image2,lat2,lon2,/noerase
;- Make images the second time
!p.multi=[0,1,2,0,0]
imagemap,image1,lat1,lon1
imagemap,image2,lat2,lon2,/noeraseSample images