ENVIAgZones
This is a reference to an ENVIAgZones object.
This object requires a separate license for the ENVI Crop Science Module; contact your sales representative for more information.
Example
This example runs AgCreateZones Task to create a classification raster and a zones object named outZones
. It prints the properties of the zones object.
; Start the application
e = ENVI(/HEADLESS)
; Open a DEM file
File = Filepath('FieldDEM.dat', $
Subdir=['data','crop_science'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
; Get the task from the catalog of ENVITasks
Task = ENVITask('AgCreateZones')
; Define inputs
Task.INPUT_RASTER = Raster
Task.MINIMUM_AREA = 2023
Task.NUMBER_OF_APPLICATION_CATEGORIES = 5
; Define outputs
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
; Run the task
Task.Execute
; Get the zones object
outZones = Task.OUTPUT_ZONES
; Print the object properties
Print, outZones
Syntax
Result = ENVIAgZones(URI=value [, Properties=value] [, Keywords=value])
Or:
Result = ENVIAgZones(VECTOR=ENVIVector [, Properties=value] [, Keywords=value])
Or:
Result = ENVIAgZones(ZONES=ENVIAgZones [, Properties=value] [, Keywords=value])
Arguments
None
Methods
Properties
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.
Note: The following properties are available for the overall ENVIAgZones object. If the zones object was created using AgCreateZones Task, the object will contain additional properties for each individual zone. See AgCreateZones Task for a list of these attributes.
ATTRIBUTES (Init, Get)
A hash containing zone-specific attributes.
You can add custom attributes by initializing the object as follows. In this example, MyURI
is a variable containing a uniform resource indicator (URI) to a previously saved ENVIAgZones file (.sav
).
zones = ENVIAgZones(URI=MyURI, $
MY_DESCRIPTION='text string', $
MY_VALUES=arrayOfValues)
If you will export the object to a shapefile using AgConvertZonesToShapefile Task, the only attributes that will be written to it are arrays of integers, floating-point values, or strings, where the number of elements in the array equals the number of zones. In addition, attribute names must have 10 characters or less. Names longer than 10 characters will be truncated in the shapefile.
COORD_SYS (Get)
This is an ENVICoordSys object that contains the coordinate system information for the ENVIAgZones object.
PARTS (Get)
This is a list of arrays that accompanies VERTICES. It contains the starting indices of each section of vertices for each zone. It is used to identify holes. Zones without holes will have a single-element array, [0].
URI (Init, Get)
This is a fully qualified filename and path of the output ENVIAgZones object.
VERTICES (Get)
This is a list of [2, n] arrays of x, y map coordinates for each zone, where n is equal to the number of points defining each zone. The number of elements in the list is equal to the number of zones.
Keywords
You must specify the URI, VECTOR, or ZONES keyword, but not more than one.
ATTRIBUTES (optional)
Specify a hash containing zone-specific attributes. The hash is not case-sensitive.
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.
URI
Set this keyword to a fully qualified URI with the path and filename of a previously saved ENVIAgZones file (.sav
). Or, set it to a new path and filename.
VECTOR
Specify an ENVIVector object (in shapefile format) that defines the vertices of the zones. The ENVIVector object must contain a ZONE_ID attribute.
ZONES
Set this keyword to an existing ENVIAgZones object.
Version History
Crop Science 1.1 |
Introduced |
See Also
AgCreateZones Task, AgConvertZonesToShapefile Task, AgCalculateAndRasterizeZoneMetrics Task, AgCalculateAndRasterizeZoneMetricsWithSpectralIndex Task,