GBDX

ENVI® Spectral Angle Mapper Classification

This task performs a Spectral Angle Mapper (SAM) supervised classification. SAM is a physically based spectral classification that uses an n-D angle to match pixels to reference spectra.

GBDX Registered Name: ENVI_SpectralAngleMapperClassification

Provider: Harris Geospatial Solutions

Imagery Examples

Before: WorldView 3 image after Advanced Image Preprocessing (AOP) correction

Before: WorldView 3 image after Advanced Image Preprocessing (AOP) correction

After: WorldView 3 image after Spectral Angle Mapper Classification

After: WorldView 3 image after Spectral Angle Mapper Classification

Quickstart

This is a workflow example for basic processing.

# Quickstart Example running the task name.

# Initialize the Environment.
from gbdxtools import Interface
gbdx = Interface()

tasks = []
cat_id = '104001002D1B2100'
aop_output_location = 'ENVI/SAM/aop/'
task_output_location = 'ENVI/SAM/task/'

# Define mean spectra of targets. Can be retrieved from the image itself using polygons and regions of interest.
# In this example we have defined the mean spectra already using polygons, zonal statistics, and QGIS.
Roof1 = [2271.066017316017223, 2353.265151515151501, 2395.317099567099376, 2444.166666666666515, 2360.438311688311842, 2387.196969696969518, 2137.296536796536657, 2005.09632034632]
Roof2 =[6292.281395348837577, 7127.568217054263187, 7575.628682170542561, 7330.892248062015824, 8365.727131782945435, 8884.883720930232812, 9051.915503875969080, 8958.96434108527]
Water = [267.146636324847123, 295.592945526952064, 404.243919783814533, 467.852936993315325, 401.381026880955744, 338.411890200540483, 176.349452424975112, 234.388849381311]
Veg1 = [323.597002293327535, 323.681718903571038, 550.086300098285506, 470.528557387790784, 398.081713443267461, 2148.839439772851165, 4809.260429179862513, 4679.97679370973]
Veg2 = [409.330224375195826, 437.896753669293616, 603.195526956354115, 652.429421830188176, 700.548164750680826, 1420.876244185766382, 2232.687103848842071, 2368.91352758297]


# Auto ordering task parameters
order = gbdx.Task("Auto_Ordering")
order.inputs.cat_id = cat_id
order.impersonation_allowed = True
order.persist = True
order.timeout = 36000
order_data_loc = order.outputs.s3_location.value
tasks.append(order)

# AOP task parameters (PAN Only)
aop_task = gbdx.Task("AOP_Strip_Processor")
aop_task.inputs.data = order_data_loc
aop_task.inputs.enable_acomp = True
aop_task.inputs.enable_dra = False
aop_task.inputs.enable_pansharpen = False
aop_task_output = aop_task.outputs.data.value
tasks.append(aop_task)

# ENVI SAM parameters
ENVI_sam = gbdx.Task("ENVI_SpectralAngleMapperClassification")
ENVI_sam.inputs.input_raster = aop_task_output
ENVI_sam.inputs.input_raster_band_grouping = 'multispectral'
ENVI_sam.inputs.class_names = '["Roof1", "Roof2", "Water", "Veg1", "Veg2"]'
ENVI_sam.inputs.mean = '[{}, {}, {}, {}, {}]'.format(Roof1, Roof2, Water, Veg1, Veg2)
ENVI_sam.inputs.output_rule_raster_uri_filename = "rule"
ENVI_sam.inputs.output_raster_uri_filename = "data"
ENVI_sam.impersonation_allowed = True
tasks.append(ENVI_sam)

# Set up workflow save data
workflow = gbdx.Workflow(tasks)
workflow.savedata(aop_task.outputs.data, location=aop_output_location)
workflow.savedata(ENVI_sam.outputs.output_raster_uri, location=task_output_location)
workflow.savedata(ENVI_sam.outputs.task_meta_data, location=task_output_location)

# Execute workflow
workflow.execute()

Inputs

The following table lists all ENVI_SpectralAngleMapperClassification inputs.
Mandatory (optional) settings are listed as Required = True (Required = False).

Name Required Default Valid Values Description
file_types False N/A string GBDX Option. Comma seperated list of permitted file type extensions. Use this to filter input files -- Value Type: STRING[*]
input_raster True N/A See ENVIRASTER input type Specify a raster on which to perform supervised classification. -- Value Type: ENVIRASTER
input_raster_format False N/A See ENVIRASTER input type Provide the format of the image, for example: landsat-8. -- Value Type: STRING
input_raster_band_grouping False N/A See ENVIRASTER input type Provide the name of the band grouping to be used in the task, ie - panchromatic. -- Value Type: STRING
input_raster_filename False N/A See ENVIRASTER input type Provide the explicit relative raster filename that ENVI will open. This overrides any file lookup in the task runner. -- Value Type: STRING
class_colors False N/A string This is an array of RGB triplets representing the class colors as defined by the input vector. -- Value Type: BYTEARRAY
threshold_angle False [1.5708] string Specify an array of values in radians between 0 and 1.5708 (pi/2). The default value is 1.5708. You can specify a one-element array to use the same threshold value for all classes. Or, specify an n-element array (where n equals the number of classes), with separate threshold values for each class. -- Value Type: DOUBLEARRAY -- Default Value: [1.5708]
output_rule_raster_uri_filename False N/A string Specify a string with the fully-qualified path and filename for OUTPUT_RULE_RASTER. -- Value Type: STRING
output_raster_uri_filename False N/A string Specify a string with the fully-qualified path and filename for OUTPUT_RASTER. -- Value Type: STRING
class_names False N/A string This is an array of class names as defined by the input vector. -- Value Type: STRINGARRAY
mean True N/A string Specify an array that is [number of bands,number of classes]. -- Value Type: DOUBLEARRAY

Outputs

The following table lists all ENVI_SpectralAngleMapperClassification outputs.
Mandatory (optional) settings are listed as Required = True (Required = False).

Name Required Default Valid Values Description
task_meta_data False N/A directory GBDX Option. Output location for task meta data such as execution log and output JSON
output_rule_raster_uri True N/A directory Output for OUTPUT_RULE_RASTER. -- Value Type: ENVIURI
output_raster_uri True N/A directory Output for OUTPUT_RASTER. -- Value Type: ENVIURI

Output structure

The output_rule_raster_uri file will be written to the specified S3 Customer Account Location.The output_raster_uri file will be written to the specified S3 Customer Account Location.

Background

For additional background information on this task please refer to the Harris Geospatial ENVI documentation and
ENVI® Spectral Angle Mapper Classification.

Contact

If you have any questions or issues with this task, please contact gbdx-support@digitalglobe.com.

ENVI® Spectral Angle Mapper Classification

This task performs a Spectral Angle Mapper (SAM) supervised classification. SAM is a physically based spectral classification that uses an n-D angle to match pixels to reference spectra.

GBDX Registered Name: ENVI_SpectralAngleMapperClassification

Provider: Harris Geospatial Solutions