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:
- Opens an RGB image of emerging cotton plants, captured by an unmanned aerial vehicle (UAV). Image courtesy of Drone Global Network.
- Runs ENVIAgCropCount on the green band of the image, to count the crops and to create an ENVIAgCrops object.
- Creates a shapefile from the ENVIAgCrops object.
- 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 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)
; Create a shapefile of the crops object
outVector = ENVIAgCropsToShapefile(outCrops)
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.
- 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 Manage Errors for more information on error handling in ENVI programming.
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
Crop Science 1.0 |
Introduced |
See Also
AgCropsToShapefile Task, ENVIAgCrops, ENVIAgCropCount, AgCropCount Task