This task divides an input raster into management zones, based on the desired number of application categories that you specify. For example, you may decide to divide your field into three different categories, each having a different level of water or fertilizer application. The task further splits the application categories into zones, which are polygons that belong to the same application category but are spatially separated. The task creates a classification image, where the classes represent the zones, and the colors indicate the application categories they belong to. It also creates a zones output object that contains data for each individual zone.

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

Example


; Start the application
e = ENVI()
 
; 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
 
; Run the task
Task.Execute
 
; Get the collection of objects currently in the Data Manager
DataColl = e.Data
 
; Add the output to the data collection
DataColl.Add, Task.OUTPUT_RASTER
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Raster)
Layer2 = View.CreateLayer(Task.OUTPUT_RASTER)

Syntax


Result = ENVITask('AgCreateZones')

Input properties (Set, Get): INPUT_RASTER, MAXIMUM_AREA, MINIMUM_AREA, NUMBER_OF_APPLICATION_CATEGORIES, OUTPUT_RASTER_URI, OUTPUT_ZONES_URI, PRIMARY_ANGLE

Output properties (Get only): OUTPUT_HOMOGENEITY_RATIO, OUTPUT_NUMBER_OF_ZONES, OUTPUT_RASTER, OUTPUT_ZONES

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 a single-band input raster.

MAXIMUM_AREA (optional)

Specify the maximum area of each zone. The area is measured in square meters if the input raster has a spatial reference. Otherwise, specify the number of square pixels for the area. The default value is 0, which means no splitting will occur.

MINIMUM_AREA (optional)

Specify the minimum area of each zone. The area is measured in square meters if the input raster has a spatial reference. Otherwise, specify the number of square pixels for the area. The default value is 2000 square meters, or about half an acre.

NUMBER_OF_APPLICATION_CATEGORIES (optional)

Specify the desired number of application categories. The default value is 3. In some cases, the actual number of application categories may be less than the specified number. This can happen, for example, when the specified minimum area results in all of the zones in an application category being merged into another application category.

OUTPUT_HOMOGENEITY_RATIO

This is a measure of how much more similar values in a class are to each other, versus values over the whole image. A value of 0 indicates no improvement, and a value of 1.0 indicates perfect improvement.

OUTPUT_NUMBER_OF_ZONES

This is the total number of zones created.

OUTPUT_RASTER

This is a reference to the output classification raster.

OUTPUT_RASTER_URI (optional)

Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER. If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.

OUTPUT_ZONES

This is a reference to the output ENVIAgZones object. In addition to the standard ENVIAgZone properties, the object will also contain the following attributes:

  • APPLICATION_CATEGORY_MAX: The maximum pixel value for each application category
  • APPLICATION_CATEGORY_MIN: The minimum pixel value for each application category
  • APPLICATION_CATEGORY_NAME: Strings with the name of each application category
  • AREA: The area in square meters of each zone
  • CAT_ID: Integer IDs of the application category corresponding to each zone, starting at 1. These IDs correspond to the application category id of the classification image.
  • CLASS_CLRS: The red/green/blue (RGB) color values for each zone. The name CLASS_CLRS is retained to be consistent with the zone classification raster.
  • CLASS_NAME: Strings with the name of each zone. The name CLASS_NAME is retained to be consistent with the zone classification raster.
  • HOMOGENEITY_RATIO: A measure of how much more similar values in a class are to each other, versus values over the whole image. A value of 0 indicates no improvement, and a value of 1.0 indicates perfect improvement.
  • NZONES: The number of zones
  • ZONE_ID: Integer IDs for each zone, starting at 1. These match the class values in the zone classification raster.

OUTPUT_ZONES_URI (optional)

Specify a string with the fully qualified filename and path of the output ENVIAgZones object.

PRIMARY_ANGLE (optional)

Specify the primary angle of the field in degrees clockwise from 0, where a value of 0 represents a horizontal alignment of the field. Zones will be split along this angle.

Version History


Crop Science 1.1

Introduced

See Also


ENVIAgZones, AgConvertZonesToShapefile Task, AgCalculateZoneMetrics Task, AgRasterizeZones Task, AgCalculateAndRasterizeZoneMetrics Task