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


  >  Docs Center  >  ENVI API  >  Processing  >  ENVICreateSubrectsFromVectorTask

ENVICreateSubrectsFromVectorTask

ENVICreateSubrectsFromVectorTask

This task creates a 2D array of subrects based on the spatial extent of individual vector records. A subrect is a bounding box used to spatially subset a raster. The number of resulting subrects will be equal to the number of separate vector records.

It is part of a sequence for dicing rasters:

Consider using ENVIDiceRasterByVector to perform these steps in one task.

Example


; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Open a vector file
VectorFile = Filepath('qb_boulder_msi_vectors.shp', $
  SUBDIRECTORY=['data'], ROOT_DIR=e.Root_Dir)
Vector = e.OpenVector(VectorFile)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('CreateSubrectsFromVector')
 
; Define inputs
Task.INPUT_VECTOR = Vector
Task.INPUT_RASTER = Raster
 
; Run the task
Task.Execute
 
; Get the resulting subrects
Subrects = Task.SUBRECTS
 
; Get a list of names that could be used for the subrect areas
SubNames = Task.SUBRECT_NAMES
 
; Print information about the subrects
Help, Subrects

IDL prints:

SUBRECTS   LONG   =Array[4, 22]

This shows that 22 subrects were created with four coordinate points each. Now pass the subrects to ENVIDiceRasterBySubrectsTask:

; Dice raster by subrects
DiceTask = ENVITask('DiceRasterBySubrects')
 
; Define inputs
DiceTask.INPUT_RASTER = Raster
DiceTask.SUBRECT_ARRAY = Subrects
DiceTask.SUBRECT_NAMES = SubNames
 
; Run the task
DiceTask.Execute
 
; Export the rasters to disk
ExportTask = ENVITask('ExportRastersToDirectory')
 
; Define inputs
ExportTask.INPUT_RASTER = DiceTask.OUTPUT_RASTER
ExportTask.OUTPUT_DIRECTORY = Filepath('', /TMP)
 
; Run the task
ExportTask.Execute

Syntax


Result = ENVITask('CreateSubrectsFromVector')

Input properties (Set, Get): INPUT_RASTER, INPUT_VECTOR

Output properties (Get only): SUBRECTS, SUBRECT_NAMES

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:

AddParameter

Execute

Parameter

ParameterNames

RemoveParameter

Properties


This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

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 create the subrects.

SUBRECTS

This property contains an array of output subrects.

SUBRECT_NAMES

This property contains the names of each output subrect.

API Version


3.3

Version History


ENVI 5.4

Introduced

See Also


ENVITask, ENVITask::Parameter, ENVISubsetRaster, ENVICreateSubrectsFromDistanceTask, ENVICreateSubrectsFromPixelsTask, ENVICreateSubrectsFromROITask, ENVICreateSubrectsFromTileCountTask, ENVICreateSubrectsFromVectorTask, ENVIDiceRasterByDistanceTask, ENVIDiceRasterBySubrectsTask, ENVIDiceRasterByPixelTask, ENVIDiceRasterByTileCount, ENVIExportRastersToDirectoryTask



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