The Encode function method base64-encodes GeoJSON code containing bounding box information. It compresses the code for writing to the header of an object detection raster.

This method is part of ENVI Deep Learning, which requires a separate license and installation.


Sample data files are available on our ENVI Tutorials web page. Click the "Deep Learning" link in the ENVI Tutorial Data section to download a .zip file containing the data. Extract the contents of the .zip file to a local directory. Files are located in the object_detection folder.

This example removes two bounding boxes from an object detection raster. It then updates the metadata of the object detection raster.

; Start the application
; Open an object detection raster
; Update the following line with the correct path
; to the tutorial data files
File = 'C:\MyTutorialFiles\ObjectDetectionRaster_HandicapParkingSpots1.dat'
Raster = ENVIDeepLearningObjectDetectionRaster(File)
; Decode the GeoJSON bounding box information from the
; object detection raster metadata
bboxInfo = ENVIDeepLearningObjectDetectionRaster.Decode( $
; Create a bounding box set
bboxSet = ENVIBoundingBoxSet(INPUT_GEOJSON = bboxInfo)
; Remove two bounding boxes
bboxSet.RemoveBoundingBox, CLASS=0, INDEX=0
bboxSet.RemoveBoundingBox, CLASS=0, INDEX=13
; Get the updated bounding box information
updatedGeoJSON = bboxSet.GetGeoJSON()
; Encode the bounding box information
updatedRaster = $
; Update the object detection raster metadata with
; the new bounding box information


Result = ENVIDeepLearningObjectDetectionRaster.Encode(InputGeoJSON [, ERROR=value])

Return Value

This method returns base64-encoded and compressed GeoJSON code.



Specify standard GeoJSON code containing bounding box information. This can be an input file (.json), string, Hash, Ordered Hash, or an ENVIGeoJSON object.



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.

Version History



See Also