DiceRasterByVector Task
This task separates a raster into tiles based on the spatial extent of individual vector records. The number of resulting tiles will be equal to the number of separate vector records.
Example
; Start the application
e = ENVI()
; Open an input raster file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
; Open an input vector file
File = Filepath('qb_boulder_msi_vectors.shp', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Vector = e.OpenVector(File)
; Get the task from the catalog of ENVITasks
Task = ENVITask('DiceRasterByVector')
; Define inputs
Task.INPUT_RASTER = Raster
Task.INPUT_VECTOR = Vector
; Define output location
Task.OUTPUT_DIRECTORY = Filepath('', /TMP)
; Run the task
Task.Execute
; Get the data collection
DataColl = e.Data
; Add the output to the data collection
DataColl.Add, Task.Output_Raster
; Display the results
View1 = e.GetView()
for i=0,N_Elements(Task.Output_Raster)-1 do $
Layer = View1.CreateLayer(Task.Output_Raster[i])
View1.Zoom, /FULL_EXTENT
Syntax
Result = ENVITask('DiceRasterByVector')
Input properties (Set, Get): INPUT_RASTER, INPUT_VECTOR, OUTPUT_DIRECTORY
Output properties (Get only): OUTPUT_RASTER
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.
Methods
This task inherits the following methods from ENVITask:
Properties
This task inherits the following properties from ENVITask:
This task also contains the following properties:
INPUT_RASTER (required)
Specify the input raster.
INPUT_VECTOR (required)
Specify the input vector shapefile that will be used to tile the input raster.
OUTPUT_DIRECTORY (optional)
Specify the output directory for the tiles. If set to an asterisk (*), the output rasters will be virtual. This will not be written to disk, and the directory will not be created. If you do not set this property, the tiles will save to the directory indicated by the ENVI Output Directory preference.
OUTPUT_RASTER
This property contains an array of output rasters. Their filenames contain the root name of the input raster with "Areaxx" appended, where xx is the vector record number.
Version History
ENVI 5.4 |
Introduced |
ENVI 5.5 |
OUTPUT_DIRECTORY now supports '*', which allows OUTPUT_RASTER to be virtual output. |
API Version
4.2
See Also
ENVITask, ENVITask::Parameter, ENVISubsetRaster, CreateSubrectsFromDistance Task, CreateSubrectsFromPixels Task, CreateSubrectsFromTileCount Task, CreateSubrectsFromVector Task, DiceRasterByDistance Task, DiceRasterByPixel Task, DiceRasterBySubrects Task, DiceRasterByTileCount Task, ExportRastersToDirectory Task