GeoJSONToROI Task
This task converts GeoJSON features to one or more regions of interest (ROIs).
GeoJSON is a geospatial format based on JSON code that is used for encoding geographic data structures. For more information, see the GeoJSON Format Specification. Also see the GeoJSONLint web page for example code and for tools that validate GeoJSON code.
Example
This example creates multiple ROIs from multiple GeoJSON features:
; Start the application
e = ENVI()
; Open a GeoJSON file
File = Filepath('boulder_multiple_features.json', $
Subdir=['data', 'geojson'], $
Root_Dir=e.Root_Dir)
GeoJSON = ENVIGeoJSON(JSON_Parse(File))
; Open an associated raster file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
; Get the task from the catalog of ENVITasks
task = ENVITask('GeoJSONToROI')
; Define task inputs
task.Input_GeoJSON = GeoJSON
; Run the task
task.Execute
; Display the result
view = e.GetView()
layer = view.CreateLayer(Raster)
rois = task.OUTPUT_ROI
roiLayers = OBJARR(N_ELEMENTS(rois))
FOR i=0, N_ELEMENTS(rois)-1 DO roiLayers[i] = layer.AddROI(rois[i])
Syntax
Result = ENVITask('GeoJSONToROI')
Input parameters (Set, Get): INPUT_GEOJSON, OUTPUT_ROI_URI
Output parameters (Get only): OUTPUT_ROI
Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.
Input Parameters
INPUT_GEOJSON (required)
Specify an input GeoJSON object. You can add name and color properties to each Feature object. See the example code in this topic.
To ensure properly validated GeoJSON code, refer to the GeoJSONLint web page.
OUTPUT_ROI_URI (optional)
Specify a string with the fully qualified path and filename for OUTPUT_ROI.
Output Parameters
OUTPUT_ROI
This is a reference to the output ROI. The output can be an array of ROIs if the input GeoJSON contains a Feature Collection.
Methods
Properties
Version History
|
ENVI 5.3 |
Introduced |
|
ENVI 5.5.3 |
OUTPUT_ROI can be an array of ROIs |