MAP_IMAGE

The MAP_IMAGE function returns an image (or other dataset) warped to fit the current map projection. This function provides an easy method for displaying geographical data as an image on a map. The MAP_SET procedure should be called prior to calling MAP_IMAGE.

MAP_IMAGE works in image (graphic) space. For each destination pixel (when COMPRESS is set to one) MAP_IMAGE calculates the latitude and longitude by applying the inverse map projection. This latitude and longitude are then used to index and interpolate the Image argument, obtaining an interpolated value for the destination pixel. The time required by MAP_IMAGE depends mainly on the number of pixels in the destination and the setting of the COMPRESS parameter.

MAP_IMAGE is more efficient than MAP_PATCH when the input data set is large compared to the destination area. If the converse is true, MAP_PATCH is more efficient.

For more information, see Image Display .

Calling Sequence

Result = MAP_IMAGE( Image [, Startx, Starty [, Xsize, Ysize]] )

Arguments

Image

A two-dimensional array containing the image to be overlaid on the map.

Startx

A named variable that, upon return, contains the X coordinate position where the left edge of the image should be placed on the screen.

Starty

A named variable that, upon return, contains the Y coordinate position where the left edge of the image should be placed on the screen.

Xsize

A named variable that, upon return, contains the width of the image expressed in graphic coordinate units. If the current graphics device uses scalable pixels, the values of Xsize and Ysize should be passed to the TV procedure.

Ysize

A named variable that, upon return, contains the height of the image expressed in graphic coordinate units. If the current graphics device uses scalable pixels, the values of Xsize and Ysize should be passed to the TV procedure.

Keywords

LATMIN

The latitude corresponding to the first row of Image . The default is -90 degrees. Note also that -90 <= LATMIN < LATMAX <= 90 .

LATMAX

The latitude corresponding to the last row of Image . The default value is 90 degrees. Note also that -90 <= LATMIN < LATMAX <= 90 .

LONMIN

The longitude corresponding to the first [left] column of Image_Orig. The default value is -180. Lonmin must be in the range of -180 to +180 degrees.

LONMAX

The longitude corresponding to the last column of Image_Orig. Lonmax must be larger than Lonmin. If the longitude of the last column is equal to (lonmin - (360. /Nx)) MODULO 360, it is assumed that the image covers all longitudes.

BILINEAR

Set this flag to use bilinear interpolation to soften edges in the returned image, otherwise, nearest neighbor sampling is used.

COMPRESS

This keyword, the interpolation compression flag, controls the accuracy of the results from MAP_IMAGE. The default is 4 for output devices with fixed pixel sizes. The inverse projection transformation is applied to each i th row and column. Setting this keyword to a higher number saves time while lower numbers produce more accurate results. Setting this keyword to 1 solves the inverse map transformation for every pixel of the output image.

SCALE

Set this keyword to the pixel/graphics scale factor for devices with scalable pixels (e.g., PostScript). The default is 0.02 pixels/graphic coordinate. This setting yields an approximate output image size of 350 x 250. Make this number larger for more resolution (and larger PostScript files and images), or smaller for faster, smaller, and less accurate images.

MAX_VALUE

Data points with values equal to or greater than this value will be treated as missing data, and will be set to the value specified by the MISSING keyword.

MIN_VALUE

Data points with values equal to or less than this value will be treated as missing data, and will be set to the value specified by the MISSING keyword.

MISSING

The pixel value to set areas outside the valid map coordinates. If this keyword is omitted, areas outside the map are set to 255 (white) if the current graphics device is PostScript, otherwise they are set to 0.

Example

The following lines of code set up an orthographic map projection and warp a simple image to it.

IMAGE = BYTSCL(SIN(DIST(400)/10)) ; Create a simple image to be warped.

TV, IMAGE ; Display the image so we can see what it looks like before warping.

Minlat=-65

Maxlat=65

Minlon = 160 ; Left edge is 160 East

Maxlon = -70 + 360 ; Right edge is 70 West = +290.

limit1 = [minlat, minlon, maxlat, maxlon]

loncenter= -140

idata = replicate(100, 50, 50)

MAP_SET, 0, loncenter, 0, /ORTHO, limit=limit1

result=MAP_IMAGE(idata,startx,starty,xsize,ysize,$

    latmin=limit1(0),latmax=limit1(2),$

    lonmin=limit1(1),lonmax=limit1(3),$

    /whole_map,compress=4)

tv,result,startx,starty ; Display the warped image on the map at the proper position.

MAP_CONTINENTS, /coasts ; Draw gridlines over the map and image.

MAP_GRID,latdel=10,londel=10, /LABEL,     $

    lonlab=limit1(0)+.5, latlab=limit1(1),$

    glinestyle=0 ; Draw continent outlines.

See Also

MAP_CONTINENTS , MAP_GRID , MAP_PATCH , MAP_SET