Welcome to the Harris Geospatial documentation center. Here you will find reference guides and help documents.


  >  Docs Center  >  ENVI API  >  Data Control  >  ENVIResampleRaster

ENVIResampleRaster

ENVIResampleRaster

This function constructs an ENVIRaster from a source raster that has been resampled or spatially resized.

The result is a virtual raster, which has some additional considerations with regard to methods and properties. See Virtual Rasters for more information, including how they differ from ENVITasks.

The equivalent tasks are ENVIDimensionsResampleRasterTask, ENVIMappingResampleRasterTask, and ENVIPixelScaleResampleRasterTask .

Example


This example down-samples a 1024x1024 pixel image by a factor of 4 to produce a 256x256 image that covers the same geographic extent as the original.

; Start the application
e = ENVI()
 
; Open an input file
File = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
Raster = e.OpenRaster(File)
 
; Perform resampling
NewRaster = ENVIResampleRaster(Raster, $
  DIMENSIONS=[256,256], $
  METHOD='Nearest Neighbor')
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(NewRaster)
Layer2 = View.CreateLayer(Raster)
View.Zoom, 4.0
View.Animate, 1.0, /FLICKER

Syntax


Result = ENVIResampleRaster(Input_Raster [, Keywords=value])

Return Value


This routine returns a reference to an ENVIRaster.

Arguments


Input_Raster

Specify the input ENVIRaster. It must have a standard or pseudo spatial reference associated with it, not a GLT- or RPC-based reference.

Methods


This virtual raster inherits methods and properties from ENVIRaster; however the following methods will override the ENVIRaster methods:

Dehydrate

Hydrate

Keywords


ERROR (optional)

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

METHOD (optional)

Specify the resampling method:

  • Nearest Neighbor (default): Uses the nearest pixel without any interpolation.
  • Bilinear: Performs a linear interpolation using four pixels to resample.
  • Cubic Convolution: Uses 16 pixels to approximate the sinc function using cubic polynomials to resample the image.

NAME

Specify a string that identifies the raster.

The following keywords provide different ways to specify the size of the resampled raster. You must specify one of these keywords, but you can only set one at a time. An exception is COLUMN_MAPPING and ROW_MAPPING, which can be set together but not in combination with the other keywords.

COLUMN_MAPPING (optional)

Specify an array of numbers that indicate the column index locations in the resampled raster, for each column of pixels in the source raster. The array must have the same number of elements as the source raster's number of columns (ENVIRaster.NCOLUMNS). If you set this keyword but not ROWS_MAPPING, then no horizontal scaling will occur.

DIMENSIONS (optional)

Specify a two-element array of positive integers that indicate the pixel dimensions of the resampled raster. This provides exact geographic coverage as the source raster.

PIXEL_SCALE (optional)

Specify a positive number or two-element array of positive numbers that define how each pixel will be resized. If you specify a single value, then the resizing is the same in the x- and y-directions. Setting this keyword can result in the resampled raster having slightly different geographic extents than the source raster. Scaled pixels may not exactly cover the same geographic area as the original pixels. The upper-left corners will coincide while the right and bottom edges will be scaled by a sub-pixel amount.

ROW_MAPPING (optional)

Specify an array of numbers that indicate the row index locations in the resampled raster, for each row of pixels in the source raster. The array must have the same number of elements as the source raster's number of rows (ENVIRaster.NROWS). If you set this keyword but not COLUMN_MAPPING, then no vertical scaling will occur.

Version History


ENVI 5.2

Introduced

ENVI 5.3, Service Pack 1

Documented the dehydrated form of this virtual raster

ENVI 5.4

Added Dehydrate and Hydrate methods; added NAME keyword

API Version


3.3

See Also


ENVIRaster, ENVISpatialGridRaster, ENVIDimensionsResampleRasterTask, ENVIMappingResampleRasterTask, ENVIPixelScaleResampleRasterTask



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us