AgCropsToShapefile Task

This task converts an ENVIAgCrops object to a shapefile.

This object 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 of the image, to count the crops and to create an ENVIAgCrops object.
  3. Creates a shapefile from the ENVIAgCrops object.
  4. Displays the shapefile on top of the image.

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

; Start the application

e = ENVI(/HEADLESS)

 

; 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

countTask = ENVITask('AgCropCount')

countTask.INPUT_RASTER = subset

countTask.INCLUDE_EDGES ='true'

countTask.MINIMUM_CROP_DIAMETER = 9 ;pixels

countTask.MAXIMUM_CROP_DIAMETER = 12

countTask.NUMBER_OF_INCREMENTS= 12

countTask.GAUSSIAN_FACTOR = 0.8

countTask.PERCENT_OVERLAP = 60

countTask.INTENSITY_THRESHOLD = 0.81

countTask.Execute

outCrops = countTask.OUTPUT_CROPS

 

; Get the crops-to-shapefile task from the

; catalog of ENVITasks

shapeTask = ENVITask('AgCropsToShapefile')

 

; Define inputs

shapeTask.INPUT_CROPS = outCrops

 

; Run the task

shapeTask.Execute

Syntax

Result = ENVITask('AgCropsToShapefile')

Input properties (Set, Get): INPUT_CROPS, OUTPUT_VECTOR_URI

Output properties (Get only):OUTPUT_VECTOR

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_CROPS (required)

Specify an input ENVIAgCrops object.

OUTPUT_VECTOR

This is a reference to the output vector.

OUTPUT_VECTOR_URI (optional)

Specify a string with the fully qualified path and filename for the output ENVIVector.

Version History

Crop Science 1.0

Introduced

See Also

ENVIAgCropsToShapefile, ENVIAgCrops, ENVIAgCropCount, AgCropCount Task