This function method returns the spatial extent of the geometric intersection between two ENVIGridDefinition objects:
Example
This example creates a new spatial grid that is based on the geometric intersection of two different spatial grids. The images in the two grids are available from our ENVI Tutorials web page. Click the API Gridding Examples link to download the .zip file to your machine, then unzip the files. Update the file references in the example with the correct locations.
e = ENVI()
File1 = 'MODIS_LST_2009-03-07.dat'
MODISRaster = e.OpenRaster(File1)
MODISCoordSysString = MODISRaster.SPATIALREF.COORD_SYS_STR
MODISCoordSys = ENVICoordSys(COORD_SYS_STR=MODISCoordSysString)
File2 = 'VIIRSLST2014-03-07.dat'
VIIRSRaster = e.OpenRaster(File2)
VIIRSCoordSysString = VIIRSRaster.SPATIALREF.COORD_SYS_STR
VIIRSCoordSys = ENVICoordSys(COORD_SYS_STR=VIIRSCoordSysString)
MODISGrid = ENVIGridDefinition(MODISCoordSys, $
PIXEL_SIZE=MODISRaster.SPATIALREF.PIXEL_SIZE, $
NROWS=MODISRaster.NROWS, $
NCOLUMNS=MODISRaster.NCOLUMNS, $
TIE_POINT_MAP=MODISRaster.SPATIALREF.TIE_POINT_MAP, $
TIE_POINT_PIXEL=MODISRaster.SPATIALREF.TIE_POINT_PIXEL)
VIIRSGrid = ENVIGridDefinition(VIIRSCoordSys, $
PIXEL_SIZE=VIIRSRaster.SPATIALREF.PIXEL_SIZE, $
NROWS=VIIRSRaster.NROWS, $
NCOLUMNS=VIIRSRaster.NCOLUMNS, $
TIE_POINT_MAP=VIIRSRaster.SPATIALREF.TIE_POINT_MAP, $
TIE_POINT_PIXEL=VIIRSRaster.SPATIALREF.TIE_POINT_PIXEL)
SpatialExtent = MODISGrid.Intersection(VIIRSGrid)
IntersectGrid = ENVIGridDefinition(MODISCoordSys, $
EXTENT=SpatialExtent, $
PIXEL_SIZE=MODISRaster.SPATIALREF.PIXEL_SIZE)
ReprojectedMODIS = ENVISpatialGridRaster(MODISRaster, $
GRID_DEFINITION=IntersectGrid)
ReprojectedVIIRS = ENVISpatialGridRaster(VIIRSRaster, $
GRID_DEFINITION=IntersectGrid)
View = e.GetView()
Layer1 = View.CreateLayer(ReprojectedMODIS)
Layer2 = View.CreateLayer(ReprojectedVIIRS)
View.Animate, 2.0, /FLICKER
Syntax
Result = ENVIGridDefinition.Intersection(ENVIGridDefinition2, [, ERROR=variable])
Arguments
ENVIGridDefinition2
Specify a second ENVIGridDefinition object from which to compute an intersection.
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.
Version History
See Also
ENVIGridDefinition, ENVICoordSys, CalculateGridDefinitionFromRasterIntersection Task