Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


  >  Docs Center  >  ENVI API  >  ENVITaskEngine Examples

ENVI

ENVITaskEngine Examples

ENVITaskEngine Examples

The following examples show some common scenarios of running ENVI analytics at the command line.

Query the ENVITask Catalog


Use ENVIQueryTaskCatalogTask to get a list of available ENVITasks. The following steps show how to use this task with the envitaskengine executable:

  1. Start a terminal window.
  2. Create a scratch directory with write permissions, where any temporary output can be written. Change to that directory:
  3. mkdir sandbox
    cd sandbox
  4. Run the QueryTaskCatalog task from envitaskengine on a single line:
  5. Bash shell:

    echo '{"taskName":"QueryTaskCatalog"}' | /usr/local/harris/envi/bin/envitaskengine

    Windows terminal:

    echo {"taskName":"QueryTaskCatalog"} | "C:\Program Files\Harris\envixx\idlxx\bin\bin.x86_64\envitaskengine"

Query a Task for its Parameters


Once you have selected a specific task of interest, use ENVIQueryTaskTask to get information about its input and output parameters. The following steps show how to use ENVIQueryTaskTask with the envitaskengine executable:

  1. Start a terminal window.
  2. Create a scratch directory with write permissions, where any temporary output can be written. Change to that directory:
  3. mkdir sandbox
    cd sandbox
  4. Run the QueryTask task from envitaskengine on a single line:
  5. Bash shell:

    echo '{"taskName":"QueryTask","inputParameters":{"Task_Name":"SpectralIndex"}}' | /usr/local/harris/envi/bin/envitaskengine

    Windows terminal:

    echo {"taskName":"QueryTask","inputParameters":{"Task_Name":"SpectralIndex"}} | "C:\Program Files\Harris\envixx\idlxx\bin\bin.x86_64\envitaskengine"
  6. To view an error generated during task execution, run the above command with a fake task name:
  7. Bash shell:

    echo '{"taskName":"QueryTask","inputParameters":{"Task_Name":"DoesNotExist"}}' | /usr/local/harris/envi/bin/envitaskengine

    Windows terminal:

    echo {"taskName":"QueryTask","inputParameters":{"Task_Name":"DoesNotExist"}} | "C:\Program Files\Harris\envixx\idlxx\bin\bin.x86_64\envitaskengine"

Run the Spectral Index Task


ENVI provides many tasks that you can run with your data. See Data Processing Routines for a list of available ENVITasks. The following example shows how to run ENVISpectralIndexTask with a QuickBird image located in the ENVI installation path.

Note: You would normally run ENVIQuerySpectralIndicesTask first to see what indices you can compute on an image before running ENVISpectralIndexTask. This example does not use ENVIQuerySpectralIndicesTask.

  1. Start a terminal window.
  2. Create a scratch directory with write permissions, where the output will be written. Change to that directory:
  3. mkdir sandbox
    cd sandbox
  4. Create a spectralIndex.json file in the scratch directory with the following JSON code.
  5. Tip: On Windows systems, update the URL key to "C:\\Program Files\\Harris\\envixx\\data\\qb_boulder_msi".

     
    {
       "taskName": "SpectralIndex",
       "inputParameters": {
          "Input_Raster": {
             "Factory": "URLRaster",
             "URL": "/usr/local/harris/envi/data/qb_boulder_msi"
             },
          "Index": "Normalized Difference Vegetation Index"
          }
    }
  6. Run the SpectralIndex task from the envitaskengine executable using the newly created file:
  7. Bash shell:

    /usr/local/harris/envi/bin/envitaskengine < spectralIndex.json

    Windows terminal:

    "C:\Program Files\Harris\envixx\idlxx\bin\bin.x86_64\envitaskengine" < spectralIndex.json
  8. Notice that the output is written to the scratch directory. If you want the output in a different location, set the Output_Raster_URI parameter of the SpectralIndex task.
  9. To process a spatial subset of the image, update the spectralIndex.json file as follows.
  10. Tip: On Windows systems, update the URL key to "C:\\Program Files\\Harris\\envixx\\data\\qb_boulder_msi". Also see Supported Data Types for details on specifying ENVI and IDL data types for the envitaskengine executable.

    {
       "taskName": "SpectralIndex",
       "inputParameters": {
          "Input_Raster": {
             "Factory": "SubsetRaster",
             "Sub_Rect": [600,200,799,399],
             "Input_Raster": {
                "factory": "URLRaster",
                "URL": "/usr/local/harris/envi/data/qb_boulder_msi"
                }
             },
          "Index": "Normalized Difference Vegetation Index"
          }
    }
  11. Run the updated Spectral Index task from the envitaskengine executable using the newly created file. Notice that the generated file is smaller since it is a spatial subset of the original image.
  12. Bash shell:

    /usr/local/harris/envi/bin/envitaskengine < spectralIndex.json

    Windows terminal:

    "C:\Program Files\Harris\envixx\idlxx\bin\bin.x86_64\envitaskengine" < spectralIndex.json



© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us