{"_id":"5ada9d1e2400ce00031703aa","project":"55faeacad0e22017005b8265","version":{"_id":"55faeacad0e22017005b8268","project":"55faeacad0e22017005b8265","__v":36,"createdAt":"2015-09-17T16:31:06.800Z","releaseDate":"2015-09-17T16:31:06.800Z","categories":["55faeacbd0e22017005b8269","55faf550764f50210095078e","55faf5b5626c341700fd9e96","55faf8a7825d5f19001fa386","560052f91503430d007cc88f","560054f73aa0520d00da0b1a","56005aaf6932a00d00ba7c62","56005c273aa0520d00da0b3f","5601ae7681a9670d006d164d","5601ae926811d00d00ceb487","5601aeb064866b1900f4768d","5601aee850ee460d0002224c","5601afa02499c119000faf19","5601afd381a9670d006d1652","561d4c78281aec0d00eb27b6","561d588d8ca8b90d00210219","563a5f934cc3621900ac278c","5665c5763889610d0008a29e","566710a36819320d000c2e93","56ddf6df8a5ae10e008e3926","56e1c96b2506700e00de6e83","56e1ccc4e416450e00b9e48c","56e1ccdfe63f910e00e59870","56e1cd10bc46be0e002af26a","56e1cd21e416450e00b9e48e","56e3139a51857d0e008e77be","573b4f62ef164e2900a2b881","57c9d1335fd8ca0e006308ed","57e2bd9d1e7b7220000d7fa5","57f2b992ac30911900c7c2b6","58adb5c275df0f1b001ed59b","58c81b5c6dc7140f003c3c46","595412446ed4d9001b3e7b37","59e76ce41938310028037295","5a009de510890d001c2aabfe","5a96f89c89442e002041144b"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"v1","version_clean":"1.0.0","version":"1"},"category":{"_id":"573b4f62ef164e2900a2b881","__v":0,"project":"55faeacad0e22017005b8265","version":"55faeacad0e22017005b8268","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-05-17T17:05:38.443Z","from_sync":false,"order":9,"slug":"algorithm-guide","title":"Algorithms"},"user":"5a904b636bddb90012a75607","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-04-21T02:08:30.542Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":160,"body":"### Imagery Examples\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/43580c9-ENVI_SAM_Before_web.jpg\",\n        \"ENVI_SAM_Before_web.jpg\",\n        566,\n        400,\n        \"#4b594f\"\n      ],\n      \"caption\": \"Before: WorldView 3 image after Advanced Image Preprocessing (AOP) correction\"\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/72fc9e5-ENVI_SAM_After_web.jpg\",\n        \"ENVI_SAM_After_web.jpg\",\n        566,\n        400,\n        \"#1b9427\"\n      ],\n      \"caption\": \"After: WorldView 3 image after Spectral Angle Mapper Classification\"\n    }\n  ]\n}\n[/block]\n### Quickstart\nThis is a workflow example for basic processing.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# Quickstart Example running the task name.\\n\\n# Initialize the Environment.\\nfrom gbdxtools import Interface\\ngbdx = Interface()\\n\\ntasks = []\\ncat_id = '104001002D1B2100'\\naop_output_location = 'ENVI/SAM/aop/'\\ntask_output_location = 'ENVI/SAM/task/'\\n\\n# Define mean spectra of targets. Can be retrieved from the image itself using polygons and regions of interest.\\n# In this example we have defined the mean spectra already using polygons, zonal statistics, and QGIS.\\nRoof1 = [2271.066017316017223, 2353.265151515151501, 2395.317099567099376, 2444.166666666666515, 2360.438311688311842, 2387.196969696969518, 2137.296536796536657, 2005.09632034632]\\nRoof2 =[6292.281395348837577, 7127.568217054263187, 7575.628682170542561, 7330.892248062015824, 8365.727131782945435, 8884.883720930232812, 9051.915503875969080, 8958.96434108527]\\nWater = [267.146636324847123, 295.592945526952064, 404.243919783814533, 467.852936993315325, 401.381026880955744, 338.411890200540483, 176.349452424975112, 234.388849381311]\\nVeg1 = [323.597002293327535, 323.681718903571038, 550.086300098285506, 470.528557387790784, 398.081713443267461, 2148.839439772851165, 4809.260429179862513, 4679.97679370973]\\nVeg2 = [409.330224375195826, 437.896753669293616, 603.195526956354115, 652.429421830188176, 700.548164750680826, 1420.876244185766382, 2232.687103848842071, 2368.91352758297]\\n\\n\\n# Auto ordering task parameters\\norder = gbdx.Task(\\\"Auto_Ordering\\\")\\norder.inputs.cat_id = cat_id\\norder.impersonation_allowed = True\\norder.persist = True\\norder.timeout = 36000\\norder_data_loc = order.outputs.s3_location.value\\ntasks.append(order)\\n\\n# AOP task parameters (PAN Only)\\naop_task = gbdx.Task(\\\"AOP_Strip_Processor\\\")\\naop_task.inputs.data = order_data_loc\\naop_task.inputs.enable_acomp = True\\naop_task.inputs.enable_dra = False\\naop_task.inputs.enable_pansharpen = False\\naop_task_output = aop_task.outputs.data.value\\ntasks.append(aop_task)\\n\\n# ENVI SAM parameters\\nENVI_sam = gbdx.Task(\\\"ENVI_SpectralAngleMapperClassification\\\")\\nENVI_sam.inputs.input_raster = aop_task_output\\nENVI_sam.inputs.input_raster_band_grouping = 'multispectral'\\nENVI_sam.inputs.class_names = '[\\\"Roof1\\\", \\\"Roof2\\\", \\\"Water\\\", \\\"Veg1\\\", \\\"Veg2\\\"]'\\nENVI_sam.inputs.mean = '[{}, {}, {}, {}, {}]'.format(Roof1, Roof2, Water, Veg1, Veg2)\\nENVI_sam.inputs.output_rule_raster_uri_filename = \\\"rule\\\"\\nENVI_sam.inputs.output_raster_uri_filename = \\\"data\\\"\\nENVI_sam.impersonation_allowed = True\\ntasks.append(ENVI_sam)\\n\\n# Set up workflow save data\\nworkflow = gbdx.Workflow(tasks)\\nworkflow.savedata(aop_task.outputs.data, location=aop_output_location)\\nworkflow.savedata(ENVI_sam.outputs.output_raster_uri, location=task_output_location)\\nworkflow.savedata(ENVI_sam.outputs.task_meta_data, location=task_output_location)\\n\\n# Execute workflow\\nworkflow.execute()\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\n\n### Inputs\nThe following table lists all ENVI_SpectralAngleMapperClassification inputs.\nMandatory (optional) settings are listed as Required = True (Required = False).\n\n  Name  |  Required  |  Default  |  Valid Values  |  Description  \n--------|:----------:|-----------|----------------|---------------\nfile_types|False|N/A|string|GBDX Option. Comma seperated list of permitted file type extensions. Use this to filter input files -- Value Type: STRING`[*]`\ninput_raster|True|N/A|[See ENVIRASTER input type](https://gbdxdocs.digitalglobe.com/docs/envi-task-engine#section-enviraster)|Specify a raster on which to perform supervised classification. -- Value Type: ENVIRASTER\ninput_raster_format|False|N/A|[See ENVIRASTER input type](https://gbdxdocs.digitalglobe.com/docs/envi-task-engine#section-enviraster)|Provide the format of the image, for example: landsat-8. -- Value Type: STRING\ninput_raster_band_grouping|False|N/A|[See ENVIRASTER input type](https://gbdxdocs.digitalglobe.com/docs/envi-task-engine#section-enviraster)|Provide the name of the band grouping to be used in the task, ie - panchromatic. -- Value Type: STRING\ninput_raster_filename|False|N/A|[See ENVIRASTER input type](https://gbdxdocs.digitalglobe.com/docs/envi-task-engine#section-enviraster)|Provide the explicit relative raster filename that ENVI will open. This overrides any file lookup in the task runner. -- Value Type: STRING\nclass_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\nthreshold_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]`\noutput_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\noutput_raster_uri_filename|False|N/A|string|Specify a string with the fully-qualified path and filename for OUTPUT_RASTER. -- Value Type: STRING\nclass_names|False|N/A|string|This is an array of class names as defined by the input vector. -- Value Type: STRINGARRAY\nmean|True|N/A|string|Specify an array that is `[number of bands,number of classes]`. -- Value Type: DOUBLEARRAY\n\n\n### Outputs\n\nThe following table lists all ENVI_SpectralAngleMapperClassification outputs.\nMandatory (optional) settings are listed as Required = True (Required = False).\n\n  Name  |  Required  |  Default  |  Valid Values  |  Description\n--------|:----------:|-----------|----------------|---------------\ntask_meta_data|False|N/A|directory|GBDX Option. Output location for task meta data such as execution log and output JSON\noutput_rule_raster_uri|True|N/A|directory|Output for OUTPUT_RULE_RASTER. -- Value Type: ENVIURI\noutput_raster_uri|True|N/A|directory|Output for OUTPUT_RASTER. -- Value Type: ENVIURI\n\n\n**Output structure**\n\nThe 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.\n\n### Background\nFor additional background information on this task please refer to the [Harris Geospatial ENVI documentation](http://www.harrisgeospatial.com/docs/home.html) and \n[ENVI® Spectral Angle Mapper Classification](http://www.harrisgeospatial.com/docs/envispectralanglemapperclassificationtask.html). \n\n### Contact\nIf you have any questions or issues with this task, please contact [gbdx-support:::at:::digitalglobe.com](mailto:gbdx-support@digitalglobe.com).","excerpt":"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.\n    \n**GBDX Registered Name:** ENVI_SpectralAngleMapperClassification\n\n**Provider:** Harris Geospatial Solutions","slug":"envi-spectral-angle-mapper-classification","type":"basic","title":"ENVI® Spectral Angle Mapper Classification"}

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 [block:image] { "images": [ { "image": [ "https://files.readme.io/43580c9-ENVI_SAM_Before_web.jpg", "ENVI_SAM_Before_web.jpg", 566, 400, "#4b594f" ], "caption": "Before: WorldView 3 image after Advanced Image Preprocessing (AOP) correction" } ] } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/72fc9e5-ENVI_SAM_After_web.jpg", "ENVI_SAM_After_web.jpg", 566, 400, "#1b9427" ], "caption": "After: WorldView 3 image after Spectral Angle Mapper Classification" } ] } [/block] ### Quickstart This is a workflow example for basic processing. [block:code] { "codes": [ { "code": "# Quickstart Example running the task name.\n\n# Initialize the Environment.\nfrom gbdxtools import Interface\ngbdx = Interface()\n\ntasks = []\ncat_id = '104001002D1B2100'\naop_output_location = 'ENVI/SAM/aop/'\ntask_output_location = 'ENVI/SAM/task/'\n\n# Define mean spectra of targets. Can be retrieved from the image itself using polygons and regions of interest.\n# In this example we have defined the mean spectra already using polygons, zonal statistics, and QGIS.\nRoof1 = [2271.066017316017223, 2353.265151515151501, 2395.317099567099376, 2444.166666666666515, 2360.438311688311842, 2387.196969696969518, 2137.296536796536657, 2005.09632034632]\nRoof2 =[6292.281395348837577, 7127.568217054263187, 7575.628682170542561, 7330.892248062015824, 8365.727131782945435, 8884.883720930232812, 9051.915503875969080, 8958.96434108527]\nWater = [267.146636324847123, 295.592945526952064, 404.243919783814533, 467.852936993315325, 401.381026880955744, 338.411890200540483, 176.349452424975112, 234.388849381311]\nVeg1 = [323.597002293327535, 323.681718903571038, 550.086300098285506, 470.528557387790784, 398.081713443267461, 2148.839439772851165, 4809.260429179862513, 4679.97679370973]\nVeg2 = [409.330224375195826, 437.896753669293616, 603.195526956354115, 652.429421830188176, 700.548164750680826, 1420.876244185766382, 2232.687103848842071, 2368.91352758297]\n\n\n# Auto ordering task parameters\norder = gbdx.Task(\"Auto_Ordering\")\norder.inputs.cat_id = cat_id\norder.impersonation_allowed = True\norder.persist = True\norder.timeout = 36000\norder_data_loc = order.outputs.s3_location.value\ntasks.append(order)\n\n# AOP task parameters (PAN Only)\naop_task = gbdx.Task(\"AOP_Strip_Processor\")\naop_task.inputs.data = order_data_loc\naop_task.inputs.enable_acomp = True\naop_task.inputs.enable_dra = False\naop_task.inputs.enable_pansharpen = False\naop_task_output = aop_task.outputs.data.value\ntasks.append(aop_task)\n\n# ENVI SAM parameters\nENVI_sam = gbdx.Task(\"ENVI_SpectralAngleMapperClassification\")\nENVI_sam.inputs.input_raster = aop_task_output\nENVI_sam.inputs.input_raster_band_grouping = 'multispectral'\nENVI_sam.inputs.class_names = '[\"Roof1\", \"Roof2\", \"Water\", \"Veg1\", \"Veg2\"]'\nENVI_sam.inputs.mean = '[{}, {}, {}, {}, {}]'.format(Roof1, Roof2, Water, Veg1, Veg2)\nENVI_sam.inputs.output_rule_raster_uri_filename = \"rule\"\nENVI_sam.inputs.output_raster_uri_filename = \"data\"\nENVI_sam.impersonation_allowed = True\ntasks.append(ENVI_sam)\n\n# Set up workflow save data\nworkflow = gbdx.Workflow(tasks)\nworkflow.savedata(aop_task.outputs.data, location=aop_output_location)\nworkflow.savedata(ENVI_sam.outputs.output_raster_uri, location=task_output_location)\nworkflow.savedata(ENVI_sam.outputs.task_meta_data, location=task_output_location)\n\n# Execute workflow\nworkflow.execute()", "language": "python" } ] } [/block] ### 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](https://gbdxdocs.digitalglobe.com/docs/envi-task-engine#section-enviraster)|Specify a raster on which to perform supervised classification. -- Value Type: ENVIRASTER input_raster_format|False|N/A|[See ENVIRASTER input type](https://gbdxdocs.digitalglobe.com/docs/envi-task-engine#section-enviraster)|Provide the format of the image, for example: landsat-8. -- Value Type: STRING input_raster_band_grouping|False|N/A|[See ENVIRASTER input type](https://gbdxdocs.digitalglobe.com/docs/envi-task-engine#section-enviraster)|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](https://gbdxdocs.digitalglobe.com/docs/envi-task-engine#section-enviraster)|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](http://www.harrisgeospatial.com/docs/home.html) and [ENVI® Spectral Angle Mapper Classification](http://www.harrisgeospatial.com/docs/envispectralanglemapperclassificationtask.html). ### Contact If you have any questions or issues with this task, please contact [gbdx-support@digitalglobe.com](mailto:gbdx-support@digitalglobe.com).