Harris Geospatial / Docs Center / ENVI API / Data Control / ENVISpectralIndexRaster

ENVI

ENVISpectralIndexRaster

ENVISpectralIndexRaster

This function constructs an ENVIRaster from a source raster that has a spectral index applied.

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

Example


This example creates a Normalized Difference Vegetation Index (NDVI) raster. See More Examples for other use cases.

; 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)
 
; compute NDVI
NDVIImage = ENVISpectralIndexRaster(raster, 'NDVI')
 
; save it in ENVI raster format
newFile = e.GetTemporaryFilename()
NDVIImage.Export, newFile, 'ENVI'
 
; Open the NDVI image
NDVIImage = e.OpenRaster(newFile)
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(NDVIImage)

Syntax


Result = ENVISpectralIndexRaster(Input_Raster, Index [, ERROR=variable])

Return Value


This routine returns a reference to an ENVIRaster.

Arguments


Input_Raster

Specify the input ENVIRaster.

Index

Specify a string or array of strings with pre-defined spectral indices. You can use the acronym or full name for the string. Follow the hyperlinks for definitions of each index. See More Examples for an example of creating a multi-band spectral index raster.

Methods


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

Dehydrate

Hydrate

Keywords


ERROR

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.

More Examples


This example creates a raster with three bands that each provide a different spectral index.

; 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)
 
; Create a spectral index raster using an array of indices
Indices = ['Normalized Difference Vegetation Index', $
  'Simple Ratio', $
  'Difference Vegetation Index']
SIRaster = ENVISpectralIndexRaster(raster, Indices)

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

See Also


ENVIRaster, ENVIQuerySpectralIndicesTask, ENVISpectralIndexTask, ENVISpectralIndicesTask


This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR). However, it may be restricted from transfer to various embargoed countries under U.S. laws and regulations.
© 2017 Exelis Visual Information Solutions, Inc., a subsidiary of Harris Corporation