Warping Images to Maps
Image data can also be displayed on maps using Direct graphics. The MAP_IMAGE function returns a warped version of an original image that can be displayed over a map projection. In this example, elevation data for the entire globe is displayed as an image with continent outlines and grid lines overlaid.
- Define the map that you want to display, using
WORLDas the variable in which to store the map data. Define the data dimensions as a 360 by 360 square array using the DATA_DIMS function. In the IDL command line, enter: - Since we are using Direct graphics, tell IDL to use a maximum of 256 colors and load a color table.
- View the data as an image using the variable
WORLDthat you defined above. - Shift the array 180 elements in the row direction and 0 elements in the column direction to make -180 degrees the first column in the array.
- View the data as an image again, noting the difference made by the shift.

- Create a Mollweide projection with continents and gridlines.
- Warp the image using bilinear interpolation using the BLIN command to smooth the warped image and save the result in the variable
NEW. - Display the new image over the map:

- The continent outlines and thick grid lines can be displayed, as shown next, by entering:
DEVICE, RETAIN=2, DECOMPOSED=0
LOADCT, 26

The first column of data in this image corresponds to 0 degrees longitude. Because we'll use MAP_IMAGE later and it assumes that the first column of the image corresponds to -180 degrees, we'll use the SHIFT function on the data set before proceeding.
From the image contained in the data, you can create a warped image to fit any of the available map projections. Define a map projection before using MAP_IMAGE, because this routine uses the currently defined map parameters.
MAP_SET, /MOLLWEIDE, /CONT, /GRID, COLOR=100
new = MAP_IMAGE(world, sx, sy, /BILINEAR)
The SX and SY output variables in the command above contain the X and Y starting positions for displaying the image.
See the map in the previous figure and note that the warped image now displays over the existing continent and grid lines.
