The MAP_PROJ_IMAGE function warps an image (or other 2-dimensional dataset) from geographic coordinates (longitude and latitude) to a specified map projection.
| Note |
Optionally, the MAP_PROJ_IMAGE function can be used to warp an image in Cartesian (UV) coordinates from one map projection to another.
Result = MAP_PROJ_IMAGE(Image [, Range] [, /BILINEAR] [, DIMENSIONS=vector] [, IMAGE_STRUCTURE=structure] [, MAP_STRUCTURE=structure] [, MASK=variable] [, MAX_VALUE=value] [, MIN_VALUE=value] [, MISSING=value] [, UVRANGE=variable] )
This routine returns a two-dimensional array containing the warped image. The returned array has the same type as the input image.
A two-dimensional array containing the image to warp.
If you are warping Image from geographic coordinates to a map projection, Range is a four-element array specifying the longitude/latitude range (in degrees) of Image. Range has the format [Lonmin, Latmin, Lonmax, Latmax]. If Range is not supplied, the routine uses a default range of [-180, -90, 180, 90].
If you are warping Image from one map projection to another (that is, if you provide a value for the IMAGE_STRUCTURE keyword), then Range is a four-element array specifying the Cartesian (UV) range. In this case, Range must be provided and has the format [Umin, Vmin, Umax, Vmax].
| Tip |
Set this keyword to use bilinear interpolation when warping Image. By default, the routine will use nearest neighbor sampling. Bilinear interpolation will produce smoother results but may be slower.
Set this keyword equal to a two-element vector specifying the width and height of the desired Result, in pixels. If this keyword is not specified, then the Result has the same dimensions as the input Image.
If the input Image is already in a certain projection, set this keyword equal to the
Set this keyword equal to a
Set this keyword equal to a named variable that will contain a byte array of the same dimensions as the Result, containing a mask of the "good" values. Values in Result that were set to MISSING (that is, the values were either off the map or outside the range specified by the MIN_VALUE and MAX_VALUE keywords) will have a mask value of 0 (zero), while all other mask values will be 1 (one).
| Tip |
Set this keyword equal to an integer that represents the maximum value an element of the Result array should be allowed to have. Data points with values greater than or equal to this value will be treated as missing data, and will be set to the value specified by the MISSING keyword.
Set this keyword equal to an integer that represents the minimum value an element of the Result array should be allowed to have. Data points with values less than or equal to this value will be treated as missing data, and will be set to the value specified by the MISSING keyword.
Set this keyword equal to an integer value to be used for pixels that fall outside of the valid map coordinates or whose data values are outside of the range specified by the MIN_VALUE and MAX_VALUE keywords. The default value is 0.
Set this keyword equal to a named variable that will contain the range of the UV coordinates of the Result in a four-element array of the form [U min, V min, U max, V max].
The following example warps a global map from longitude/latitude (geographic) coordinates into the Interrupted Goode projection:
; Load an image in longitude/latitude (geographic) coordinates.
file = FILEPATH('avhrr.png', SUBDIRECTORY=['examples','data'])
data = READ_PNG(file, r, g, b)
; Resize the image data
red0 = REBIN(r[data], 360, 180)
green0 = REBIN(g[data], 360, 180)
blue0 = REBIN(b[data], 360, 180)
iImage, RED=red0, GREEN=green0, BLUE=blue0, $
DIMENSIONS=[500,600], VIEW_GRID=[1,3]
; First map projection.
sMap = MAP_PROJ_INIT('Interrupted Goode')
; Warp each channel to the map projection. For the first
; channel also compute the MASK and the UVRANGE.
red1 = MAP_PROJ_IMAGE(red0, MAP_STRUCTURE=sMap, MASK=mask, $
UVRANGE=uvrange)
green1 = MAP_PROJ_IMAGE(green0, MAP_STRUCTURE=sMap)
blue1 = MAP_PROJ_IMAGE(blue0, MAP_STRUCTURE=sMap)
iImage, RED=red1, GREEN=green1, BLUE=blue1, ALPHA=mask*255b, $
/VIEW_NEXT
Now warp our image from the Interrupted Goode projection to a new projection:
; New map projection.
mapStruct = MAP_PROJ_INIT('Mollweide', /GCTP)
; Now use the IMAGE_STRUCTURE keyword to warp each channel
; from the Interrupted Goode projection to Mollweide.
; We also need to input the UVRANGE of the input image.
red2 = MAP_PROJ_IMAGE(red1, uvrange, IMAGE_STRUCTURE=sMap, $
MAP_STRUCTURE=mapStruct, MASK=mask)
green2 = MAP_PROJ_IMAGE(green1, uvrange, IMAGE_STRUCTURE=sMap, $
MAP_STRUCTURE=mapStruct)
blue2 = MAP_PROJ_IMAGE(blue1, uvrange, IMAGE_STRUCTURE=sMap,$
MAP_STRUCTURE=mapStruct)
iImage, RED=red2, GREEN=green2, BLUE=blue2, ALPHA=mask*255b, $
/VIEW_NEXT
The resulting iImage tool display is shown in the following figure.
Introduced: 6.1
IMAP, MAP_IMAGE, MAP_PROJ_INIT, MAP_SET