URL:
https://<rasteranalysistools-url>/ExtractSpectraFromImage
Methods:
GET
Version Introduced:
12.2

Description

The ExtractSpectraFromImage task extracts spectral signatures from input feature data to create an Esri Spectral Library (.esl) file. The reference spectral data may be collected from the field, such as GPS data, in the form of point or polygon features. These features record the locations of the materials of interest, or class types.

Request URL:

Use dark colors for code blocksCopy
1
http://<analysis-server-url>/ExtractSpectraFromImage/submitJob?inputRaster={"itemId":"<raster_item_id>"}&inputLocationFeature={"itemId":"<feature_item_id>"}&materialNameField="ClassName"&outputName={"serviceProperties":{"name":"extracted_spectra"}}

Request parameters

ParameterDetails

inputRaster

(Required)

A multispectral or hyperspectral image that contains wavelength information.

The input raster can be the portal item ID, image service URL, cloud raster dataset, or shared raster dataset.

Syntax: A JSON object describing the input raster(s).

Example

Use dark colors for code blocksCopy
1
2
3
4
// Single item
{"itemId": <portal item id>}
{"url": <image service url>}
{"uri": <cloud raster uri or shared data path>}

inputLocationFeature

(Required)

A point or polygon feature class that defines the locations of the target materials. If the location features are polygons, an average spectra will be created for each polygon and each material type. The reference spectral data can be collected from the field or from a target image using the Training Sample Manager in ArcGIS Pro.

Syntax: A JSON object describing the input feature data.

Example

Use dark colors for code blocksCopy
1
2
{"itemId": <portal item id>}
{"url": <feature service layer url>}

materialNameField

(Required)

A field from the input location feature class that identifies the material or class name for each feature. This field value is used to label the spectral signatures in the output spectral library.

Syntax: string

Example

Use dark colors for code blocksCopy
1
materialNameField="ClassName"

outputName

(Required)

The output Esri Spectral Library (.esl) file that stores the extracted spectral signatures. The output can be stored as a new hosted item in the portal.

Example

Use dark colors for code blocksCopy
1
2
3
4
// item properties
{"name": "extracted_spectra", "folderId": "<folder_id>", "itemProperties": {}}
// uri
{"uri": <path>}

aggregateSpectra

(Optional)

Specifies whether to aggregate spectra from all input features associated with a material. The default is true.

  • true - A single representative spectrum will be generated for each material by aggregating the spectra from all input features associated with that material.
  • false - A separate spectrum will be generated for each input feature associated with a material.

context

Contains additional settings that affect task execution. This task has the following settings:

  • Extent extent—Defines the extent of the output raster.
  • Geographic Transformations geographicTransformations — Defines the transformation methods that will be used when projecting the data for analysis.
  • Output Spatial Reference outputSpatialReference—Saves the results in the specified spatial reference.

Example

The following is a sample request URL for ExtractSpectraFromImage:

Use dark colors for code blocksCopy
1
https://organization.example.com/<context>/rest/services/System/RasterAnalysisTools/GPServer/ExtractSpectraFromImage?inputRaster={"url": "<xxx/ImageServer>"}&inputLocationFeature={"itemId": "53e0085ff8ae4a318ec0e6fa84afbdcf"}&materialNameField="ClassName"&aggregateSpectra="true"&outputName={"serviceProperties":{"name":"<output_name>"}}&context={}&f=json

Response

When you submit a request, the service assigns a unique job ID for the transaction.

Syntax:

Use dark colors for code blocksCopy
1
2
3
4
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}

After the initial request is submitted you can use the jobId to periodically check the status of the job and messages as described in the topic Checking job status. Once the job has successfully completed, you use the jobId to retrieve the results. To track the status, you can make a request of the following form:

Use dark colors for code blocksCopy
1
http://<analysis url>/ExtractSpectraFromImage/jobs/<jobId>

Accessing results:

When the status of the job request is esriJobSucceded, you can access the results of the analysis by making a request of the following form.

Status check URL:

Use dark colors for code blocksCopy
1
http://<analysis url>/ExtractSpectraFromImage/jobs/<jobId>

Result retrieval URL once job succeeds:

Use dark colors for code blocksCopy
1
http://<analysis url>/ExtractSpectraFromImage/jobs/<jobId>/results/outputSpectra?token=<token>&f=json

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.