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


Harris Geospatial / Docs Center / ENVI API / Crop Science / ENVIAgCropsToShapefileTask

ENVIAgCropsToShapefileTask

ENVIAgCropsToShapefileTask

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 orthophoto of a citrus orchard.
  2. Creates a spectral index raster to make the citrus trees bright against the background. A Modified Triangular Vegetation Index (MTVI) works well in this case.
  3. Tip: See the ENVISpectralIndexRaster topic in ENVI Help for a list of spectral indices. Or, run ENVIQuerySpectralIndicesTask first to see what indices are available for your particular image.

  4. Runs ENVIAgCropCount to count the trees and to create an ENVIAgCrops object.
  5. Creates a shapefile from the ENVIAgCrops object.
  6. Displays the shapefile on top of the orthophoto.
; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('CitrusOrthophoto.dat', $
  Subdir=['data','crop_science'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Preprocess the image so that crops are bright.
MTVIImage = ENVISpectralIndexRaster(Raster, 'MTVI')
 
; Count the crops and create an ENVIAgCrops object
outCrops = ENVIAgCropCount(MTVIImage, 2.0, 5.0, $
  GAUSSIAN_FACTOR = 0, $
  /INCLUDE_EDGES, $
  INTENSITY_THRESHOLD = 0.8, $
  NUMBER_OF_INCREMENTS = 4, $
  PERCENT_OVERLAP = 100.0)
 
; Get the crops-to-shapefile task from the 
; catalog of ENVITasks
task = ENVITask('AgCropsToShapefile')
 
; Define inputs
task.INPUT_CROPS = outCrops
 
; Define outputs
task.OUTPUT_VECTOR_URI = e.GetTemporaryFilename('.shp')
 
; Run the task
task.Execute
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Raster)
Layer2 = View.CreateLayer(task.OUTPUT_VECTOR)

Syntax


Result = ENVITask('AgCropsToShapefile')

Input properties (Set, Get): INPUT_CROPS, OUTPUT_VECTOR_URI

Output properties (Get only): DESCRIPTION, NAME, 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. See the ENVITask topic in ENVI Help.

  • AddParameter
  • Execute
  • Parameter
  • ParameterNames
  • RemoveParameters

Properties


DESCRIPTION

This property describes the task.

INPUT_CROPS (required)

Specify an input ENVIAgCrops object.

NAME

This property contains the name of the task.

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


1.0

Introduced

See Also


ENVIAgCropsToShapefile, ENVIAgCrops, ENVIAgCropCount, ENVIAgCropCountTask



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us