>  Docs Center  >  Crop Science API  >  ENVIAgZones



This is a reference to an ENVIAgZones object.

This object is part of ENVI Crop Science, which requires a separate license and installation.


This example runs ENVIAgCreateZonesTask to create a classification raster and a zones object named outZones. It prints the properties of the zones object.

; Start the application
; Open a DEM file
File = Filepath('FieldDEM.dat', $
  Subdir=['data','crop_science'], $
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
; Define outputs
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
; Run the task
; Get the zones object
outZones = Task.OUTPUT_ZONES
; Print the object properties
Print, outZones


Result = ENVIAgZones(URI=value [, Properties=value] [, Keywords=value])


Result = ENVIAgZones(VECTOR=ENVIVector [, Properties=value] [, Keywords=value])


Result = ENVIAgZones(ZONES=ENVIAgZones [, Properties=value] [, Keywords=value])









Properties marked as "Init" are applied only during the initial creation of the object. Properties marked as "Set" are those that you can set to specific values after the object has been created. 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 ENVIAgCreateZonesTask, the object will contain additional properties for each individual zone. See the ENVIAgCreateZonesTask help topic for a list of these attributes.


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', $

If you will export the object to a shapefile using ENVIAgConvertZonesToShapefileTask, 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.


This is an ENVICoordSys object that contains the coordinate system information for the ENVIAgZones object.


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.


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.


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 the Manage Errors topic in ENVI Help for more information on error handling.


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.


Specify an ENVIVector object (in shapefile format) that defines the vertices of the zones. The ENVIVector object must contain a ZONE_ID attribute.


Set this keyword to an existing ENVIAgZones object.

Version History



See Also

ENVIAgCreateZonesTask, ENVIAgConvertZonesToShapefileTask, ENVIAgCalculateAndRasterizeZoneMetricsTask, ENVIAgCalculateAndRasterizeZoneMetricsWithSpectralIndexTask,


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