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 / ENVIAgCropsToShapefile

ENVIAgCropsToShapefile

ENVIAgCropsToShapefile

This function 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 full 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)
 
; Create a shapefile of the crops object
outVector = ENVIAgCropsToShapefile(outCrops, $
  OUTPUT_FILENAME=e.GetTemporaryFilename('.shp'))
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Raster)
Layer2 = View.CreateLayer(outVector)

Syntax


Result = ENVIAgCropsToShapefile(Input_Crops [, Keywords=value])

Return Value


This function returns a reference to an ENVIVector object.

Arguments


Input_Crops

Specify an input ENVIAgCrops object.

Methods


This function inherits the following methods from ENVIVector. See the ENVIVector topic in ENVI Help.

  • Close
  • Dehydrate
  • Hydrate

Keywords


ERROR (optional)

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See the Manage Errors topic in ENVI Help for more information on error handling.

OUTPUT_FILENAME (optional)

Specify a string with a fully qualified path and filename for the output ENVIVector object. If you do not set this keyword, an output file will be automatically created.

Version History


1.0

Introduced

See Also


ENVIAgCropsToShapefileTask, ENVIAgCrops, ENVIAgCropCount, ENVIAgCropCountTask



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