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

  >  Docs Center  >  ENVI API  >  Data Control  >  ENVIGLTRasterSpatialRef



This is a reference to an ENVIGLTRasterSpatialRef object, which contain properties that describe a Geographic Lookup Table (GLT) associated with an ENVIRaster.

A GLT contains map locations for every pixel of the image it is associated with. A GLT raster consists of two bands: sample numbers and line numbers of the georeferenced image. NPP VIIRS Latitude and Longitude bands combined are one example of a GLT raster object. See the Geographic Lookup Tables (GLTs) section in the Overview of Map Information topic for more information.


The most common programmatic use for ENVIGLTRasterSpatialRef is retrieving spatial properties from an ENVIRaster that contains a GLT spatial reference. This is stored in the raster's SPATIALREF property. The following code shows a general example:

; Open a raster that contains a GLT spatial reference
File = 'MyRaster.dat'
Raster = e.OpenRaster(File)
; Retrieve and print the properties of the spatial reference
Print, Raster.SPATIALREF

The next example shows how to create an ENVIGLTRasterSpatialRef object using the latitude and longitude rasters of a VIIRS Ocean Color dataset in NetCDF-4 format.

Reference: NASA Ocean Biology (OB.DAAC). Suomi NPP VIIRS Ocean Color Data, 2014.0 Reprocessing. NASA OB.DAAC, Greenbelt, MD, USA. Accessed 2016/01/21.

Replace the filename with your own data file, and update the paths to latitude and longitude rasters as needed.

; Start the application
e = ENVI(/headless)
; Open an ocean color dataset
OCfile = 'V2015305172750.L2_NPP_OC.nc'
; Get the latitude and longitude rasters
latRaster = e.OpenRaster(OCfile, $
lonRaster = e.OpenRaster(OCfile, $
; Create a GLT from the lat/lon rasters
GLTspatialRef = ENVIGLTRasterSpatialRef( $
  XMAP_GRID=lonRaster, YMAP_GRID=latRaster)
; Open the chlorophyll raster using the GLT spatial reference
chloroRaster = e.OpenRaster(OCfile, $
  DATASET_NAME='/geophysical_data/chlor_a', $


Result = ENVIGLTRasterSpatialRef([, Properties=value, ERROR=value])

Return Value

This function returns a reference to an ENVIGLTRasterSpatialRef object.














Properties marked as (Init) are applied only during the initial creation of the object. Properties marked as (Get) can be retrieved but not set. All other properties can be set during the creation of the object, or retrieved or changed after creation.

XMAP_GRID (Init, Get)

Specify a single-band, two-dimensional ENVIRaster that contains longitude values. The XMAP_GRID and YMAP_GRID rasters must have the same dimensions.

YMAP_GRID (Init, Get)

Specify a single-band, two-dimensional ENVIRaster that contains latitude values.


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.1


ENVI 5.3, Service Pack 2

Added ability to serve as a constructor function for creating new GLT spatial reference objects. Added all Convert* methods.

ENVI 5.4

Added Hydrate method

API Version


See Also

ENVIPseudoRasterSpatialRef, ENVIRPCRasterSpatialRef, ENVIStandardRasterSpatialRef, ENVIReprojectGLTTask

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