Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


  >  Docs Center  >  ENVI API  >  Crop Science  >  ENVIAgRasterizeCropsTask

ENVIAgRasterizeCropsTask

ENVIAgRasterizeCropsTask

This task creates a classification raster from an ENVIAgCrops object. The Crops class consists of circle outlines at the crop locations.

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

Example


This example performs the following steps:

  1. Opens an RGB image of emerging cotton plants, captured by an unmanned aerial vehicle (UAV). Image courtesy of Drone Global Network.
  2. Runs ENVIAgCropCount on the green band to count the crops and to create an ENVIAgCrops object.
  3. Creates a classification raster showing the locations of the crops.
  4. Displays the classification raster over the green band of the source image.

Note: The resulting crop count includes several outliers. You can use ENVIAgFindRowsAndRemoveOutliersTask to remove these.

; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('Cotton.dat', $
  SUBDIR=['data','crop_science'], $
  ROOT_DIR=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Process the green band
subset = ENVISubsetRaster(Raster, BANDS=[1])
 
; Count the crops and output an ENVIAgCrops object
outCrops = ENVIAgCropCount(subset, 9, 12, $
  GAUSSIAN_FACTOR=0.8, $
  /INCLUDE_EDGES, $
  INTENSITY_THRESHOLD=0.81, $
  NUMBER_OF_INCREMENTS=12, $
  OUTPUT_NCROPS=outputNumCrops, $
  PERCENT_OVERLAP=60)
 
; Get the rasterize task from the catalog of ENVITasks
Task = ENVITask('AgRasterizeCrops')
 
; Define the task inputs
Task.CROPS = outCrops
Task.FILLED = 'true'
 
; Define the task outputs
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
 
; 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(subset)
Layer2 = View.CreateLayer(Task.OUTPUT_RASTER)
View.Zoom, /FULL_EXTENT

Syntax


Result = ENVITask('AgRasterizeCrops')

Input properties (Set, Get): CLASSIFICATION, CROPS, FILLED, OUTPUT_METRIC, OUTPUT_RASTER_URI

Output properties (Get only): OUTPUT_RASTER

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.

Methods


This task inherits the following methods from ENVITask. See the ENVITask topic in ENVI Help.

  • AddParameter
  • Execute
  • Parameter
  • ParameterNames
  • RemoveParameters

Properties


This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

See the ENVITask topic in ENVI Help for details.

This task also contains the following properties:

CLASSIFICATION (optional)

Set this property to true (the default value) to create a classification raster where crops are colored according to relative means. For example, a dark green polygon corresponds to a crop with a higher mean value than light-green, yellow, and red polygons. The resulting raster will look similar to the following:

If you set the CLASSIFICATION property to false, the output will be a greyscale raster that is based on the actual mean values of the crops; for example:

This property is ignored if you set OUTPUT_METRIC to Count.

CROPS (required)

Specify an input ENVIAgCrops object.

FILLED (optional)

Set this property to true to create filled circles. The default is false.

OUTPUT_METRIC (optional)

Specify one of the following strings indicating the metric or count that the output raster will be based on. The default is Count.

  • Count
  • Crop Minimum
  • Crop Maximum
  • Crop Mean
  • Crop Standard Deviation
  • Radius

OUTPUT_RASTER

This is a reference to the output crops classification raster.

OUTPUT_RASTER_URI (optional)

Specify a string with the fully qualified filename and path of the output raster. If you do not specify this property, the output raster is only temporary. Once the raster has no remaining references, ENVI deletes the temporary file.

Version History


1.0

Introduced

1.1

Radius was added as an option to OUTPUT_METRIC.

See Also


ENVIAgCropCount, ENVIAgCropCountTask, ENVIAgCountAndRasterizeCropsTask, ENVIAgCalculateCropMetrics, ENVIAgCalculateCropMetricsTask



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