This function constructs an ENVIRaster from a source raster that has been reprojected to a different coordinate system. It transforms and resamples coordinates from one spatial reference (standard, RPC, or pseudo) to a standard spatial reference in the specified coordinate system. It retains the pixel size as determined from the center pixel of the original image.

This routine offers a quick way to convert non-standard projections to a standard projection. In the case of RPCs, the RPCOrthorectification task provides a more accurate orthorectification.

ENVIReprojectRaster does not support geographic lookup tables (GLTs). Use the ReprojectGLT task instead.

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 task is ReprojectRaster.


; 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)
; Get the 
; NAD_1983_StatePlane_Colorado_North_FIPS_0501_Feet
; coordinate system
CoordSys = ENVICoordSys(COORD_SYS_CODE=2231)
; Process a spatial subset
Subset = ENVISubsetRaster(Raster, Sub_Rect=[600,200,799,399])
; created a reprojected raster
ReprojectedImage = ENVIReprojectRaster(Subset, $
  COORD_SYS=CoordSys, RESAMPLING='Bilinear')
; save it in ENVI raster format
newFile = e.GetTemporaryFilename()
ReprojectedImage.Export, newFile, 'ENVI'
; Open the image
ReprojectedImage = e.OpenRaster(newFile)
; Display the result
View = e.GetView()
Layer = View.CreateLayer(ReprojectedImage)


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

Return Value

This routine returns a reference to an ENVIRaster.



Specify the input ENVIRaster.


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




COORD_SYS (required)

Specify an ENVICoordSys object representing the coordinate system to which to transform the image.


Specify a string that identifies the raster.

RESAMPLING (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.

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.

Version History

ENVI 5.3


ENVI 5.3.1

Documented the dehydrated form of this virtual raster

ENVI 5.4

Added the Dehydrate and Hydrate methods; added NAME keyword

API Version


See Also

ENVIRaster, ReprojectRaster Task, ENVICoordSys, ENVISpatialGridRaster, RegridRaster Task, ENVIPseudoRasterSpatialRef, ENVIRPCRasterSpatialRef, ENVIStandardRasterSpatialRef