The GetZoneProperty method retrieves properties (also called attributes) for a specified management zone.

This method requires a separate license for the ENVI Crop Science Module; contact your sales representative for more information.


This example runs AgCreateZones Task to create a classification raster and a zones object named outZones. It retrieves all properties for the zone with a ZONE_ID of 1.

; 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
; Get some properties that are specific to 
; the zone associated with ZONE_ID=1
outZones.GetZoneProperty, 1, $
  AREA=area, $
  CAT_ID=categoryID, $
  CLASS_NAME=className, $
; Print the values of these properties
Print, 'Area: ',area
Print, 'Category ID: ',categoryID
Print, 'Class Name: ',className
Print, 'Class Colors: ',classColors


ENVIAgZones.GetZoneProperty, ZoneID [, Keywords=value]



Specify a zone ID from which to extract attributes. If you use AgCreateZones Task to create an ENVIAgZones object, it will create a unique ID for each zone; use one of these for the ZoneID argument.


ATTRIBUTES (optional)

Specify a hash containing zone-specific attributes. The hash is not case-sensitive. An attribute is recognized as zone-specific if it is an array or list and the number of elements in the last dimension is equal to the number of zones. Not all zone-specific attributes can be exported to a shapefile. Shapefiles require a one-dimensional array of integers, floating-point values, or strings.

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.

PARTS (optional)

Set this keyword to return an array of starting indices of each section of vertices in the specified zone. It is used to identify holes. Zones without holes will have a single-element array, [0].

VERTICES (optional)

Set this keyword to return a [2, n] array of x,y map coordinates for the vertices in the specified zone, where n is the number of points defining the zone.

Version History

Crop Science 1.1


See Also

ENVIAgZones, AgCreateZones Task