This task creates a raster of zone metrics. The result is a classification image showing the relative pattern of a selected zone metric, or a grayscale image showing actual values of a selected zone metric. Use AgCalculateZoneMetrics Task to calculate zone metrics before running this task.

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

Example


This example:

  • Uses a DEM as the basis for splitting a field into five management zones.
  • Runs AgCreateZones Task to create the zones
  • Runs AgCalculateZoneMetrics Task to calculate the mean elevation values for each zone
  • Runs ENVIAgRasterizeZones and displays a grayscale image of the mean elevation values.
; 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)
 
; Create a zones object
zonesTask = ENVITask('AgCreateZones')
zonesTask.INPUT_RASTER = Raster
zonesTask.MINIMUM_AREA = 2023
zonesTask.NUMBER_OF_APPLICATION_CATEGORIES = 5
zonesTask.Execute
 
; Calculate zone metrics
metricsTask = ENVITask('AgCalculateZoneMetrics')
metricsTask.INPUT_RASTER = Raster
metricsTask.INPUT_ZONES = zonesTask.OUTPUT_ZONES
metricsTask.INPUT_ZONE_RASTER = zonesTask.OUTPUT_RASTER
metricsTask.Execute
outZones = metricsTask.OUTPUT_ZONES
 
; Create a raster of elevation means for each zone
rasterizeTask = ENVITask('AgRasterizeZones')
rasterizeTask.ZONES = outZones
rasterizeTask.INPUT_ZONE_RASTER = zonesTask.OUTPUT_RASTER
rasterizeTask.Execute
 
; Get the collection of objects currently in the Data Manager
DataColl = e.Data
 
; Add the output to the data collection
DataColl.Add, rasterizeTask.OUTPUT_RASTER
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(rasterizeTask.OUTPUT_RASTER)

Syntax


Result = ENVITask('AgRasterizeZones')

Input properties (Set, Get): CLASSIFICATION, INPUT_ZONE_RASTER, OUTPUT_METRIC, OUTPUT_RASTER_URI, ZONES

Output properties (Get only): OUTPUT_RASTER

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:

CLASSIFICATION (optional)

Set this property to true to create a classification image showing the relative pattern of a selected zone metric. The default value is false, which will create a grayscale image with the actual values of a zone metric.

INPUT_ZONE_RASTER (optional)

Specify the zone classification raster that corresponds to the input zones. It allows metrics to be calculated faster for large images.

OUTPUT_METRIC (optional)

Specify one of the following strings, indicating the metric that the output raster will be based on.

  • Zone Minimum
  • Zone Maximum
  • Zone Mean (default)
  • Zone Standard Deviation

OUTPUT_RASTER

This is a reference to the output zones 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.

ZONES (required)

Specify an input ENVIAgZones object.

Version History


Crop Science 1.1

Introduced

Crop Science 1.1.1

Added INPUT_ZONE_RASTER property

See Also


ENVIAgZones, AgCreateZones Task, AgCalculateAndRasterizeZoneMetrics Task, AgCalculateZoneMetrics Task, AgConvertZonesToShapefile Task