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 parameters (Set, Get): CLASSIFICATION, INPUT_ZONE_RASTER, OUTPUT_METRIC, OUTPUT_RASTER_URI, ZONES

Output parameters (Get only): OUTPUT_RASTER

Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.

Input Parameters


CLASSIFICATION (optional)

Set this parameter 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_URI (optional)

Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER.

  • If you do not specify this parameter, or set it to an exclamation symbol (!), ENVI creates a temporary file.
  • If you set it to the hash symbol (#), ENVI creates a file in the temporary directory, but this file will not be deleted when ENVI closes.

ZONES (required)

Specify an input ENVIAgZones object.

Output Parameters


OUTPUT_RASTER

This is a reference to the output zones raster.

Methods


Execute

Parameter

ParameterNames

Properties


DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History


Crop Science 1.1

Introduced

Crop Science 1.1.1

Added INPUT_ZONE_RASTER parameter

See Also


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