The GetENVIGeoJSON function method returns GeoJSON code suitable for creating regions of interest (ROIs) via the ENVI GeoJSONToROI task. Specifically, the returned GeoJSON code consists of a FeatureCollection of Geometry types. See the Bounding Boxes Background topic for details.

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

Tip: Consider using ENVIROIToGeoJSON instead. That function provides a simpler interface for creating GeoJSON code from polygon ROIs.

Example


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

This example creates an ROI from bounding box information stored in the metadata of an object detection raster:

; Launch the application
e = ENVI()
 
; 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( $
  Raster.METADATA['dlobjectbounds'])
 
; Create a bounding box set
bboxSet = ENVIBoundingBoxSet(INPUT_GEOJSON = bboxInfo)
_enviGeoJSON = bboxSet.GetENVIGeoJSON()
 
; Convert GeoJSON to ROI
_enviGeoJSON['crs'] = bboxInfo['crs']
task = ENVITask('GeoJSONToROI')
task.INPUT_GEOJSON = _enviGeoJSON
task.Execute
rois = task.OUTPUT_ROI
 
; Display ROI and object detection raster
View = e.GetView()
Layer = View.CreateLayer(Raster)
View.Zoom, /FULL_EXTENT
roiLayers = OBJARR(N_ELEMENTS(rois))
FOR i=0, N_ELEMENTS(rois)-1 DO roiLayers[i] = Layer.AddROI(rois[i])

Syntax


Result = ENVIBoundingBoxSet.GetENVIGeoJSON([ ERROR=value])

Return Value


This function method returns GeoJSON code that consists of a FeatureCollection of Geometry types. See the Bounding Boxes Background topic for details on this format.

Arguments


None

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.

Version History


1.2

Introduced

See Also


ENVIBoundingBoxSet