This task regrids an ENVIRaster to a spatial grid raster, which is a raster that has been reprojected and resampled to a grid with a standard spatial reference, pre-defined pixel size, and the same number of rows and columns.
This example regrids a raster to a different coordinate system. It defines a coordinate system object, creates a spatial grid definition, then reprojects the raster to the spatial grid.
; Start the application
e = ENVI()
; Open an input file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
Raster = e.OpenRaster(File)
; Define a coordinate system object for
; Colorado State Plane FIPS 0501 NAD1983
CoordSys = ENVICoordSys(COORD_SYS_CODE=2231)
; Define a spatial grid
; Create a grid definition
; [xmin, ymax, xmax, ymin]
; x is easting and y is northing
Grid = ENVIGridDefinition(CoordSys, $
; Get the reprojection task from the catalog of ENVITasks
Task = ENVITask('RegridRaster')
; Define inputs
Task.INPUT_RASTER = Raster
Task.GRID_DEFINITION = Grid
; Define outputs
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
; Run the task
; Get the collection of data objects currently available in the Data Manager
DataColl = e.Data
; Add the output to the Data Manager
; Display the result
View1 = e.GetView()
Layer1 = View1.CreateLayer(Task.Output_Raster)
Result = ENVITask('RegridRaster')
Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.
This task inherits the following methods from ENVITask:
This property describes the task.
Specify an ENVIGridDefinition object that defines the pixel size, rows and columns, and coordinate system of the desired spatial reference.
This property is now deprecated and has no effect on task behavior. All task property values are validated when they are set, and they throw an error with bad input.
Specify the raster to reproject.
This property contains the name of the task.
This is a reference to the output spatial grid raster.
Specify a string with the fully qualified filename and path of the output raster. If you do not specify this property, the output raster is only temporary. Once the raster has no remaining references, ENVI deletes the temporary file.
Specify the resampling method.
- Nearest Neighbor: Uses the nearest pixel without any interpolation.
- Bilinear (default): 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.