- URL:
- https://<root>/<serviceName>/RasterAnalysisTools/GPServer/ExtractByMask
- Methods:
GET- Version Introduced:
- 12.2
Description
The Extract task extracts raster cells within or outside a specified mask. Using a raster or feature mask, it acts like a cookie cutter to isolate and save areas of interest from a larger raster.
Example applications of Extract include the following:
- Extract a satellite image or land cover raster to a county boundary, park, or project area.
- Extract elevation data only within a forest boundary, property parcel, before running slope, aspect, or hillshade analysis
- Isolate environmental variables everywhere except protected areas, wetland boundary, or conservation region.
Request parameters
The following table lists the parameters with syntax and details for each:
| Parameter | Details |
|---|---|
| The input raster to extract. Syntax: This parameter can be specified as a portal item ID, a URL to a raster image service layer, a cloud raster dataset, or a shared raster dataset. Examples: |
| The layer that defines the area or locations where the analysis will occur. Syntax: This parameter can have either a raster input or a feature input. For raster input, this parameter can be specified as a portal item ID, a URL to a raster image service layer, a cloud raster dataset, or a shared raster dataset. For feature input, this parameter can be specified as either a URL to a feature service layer or a feature collection. Raster input examples: Feature input examples: |
|
The name of the output image service that will be created. You can specify the name, or you can create an empty service using Portal Admin Sharing API and use the return JSON object as input to this parameter. Syntax: A JSON object describes the name of the output or the output raster. Output name example: Output raster examples: |
| Specifies whether cells inside or outside the locations defined by the input mask will be selected and written to the output raster. When set as Syntax: An enumerated string value Values: |
| The extent that defines the area to be extracted. By default, the output extent is calculated as the intersection of the Input Raster and Input Raster or Feature Mask Data extents. Processing is performed only within the limits of this intersecting area. Cells outside the extent are assigned NoData values. Extent Syntax: Example: |
|
Contains additional settings that affect task processing. This task has the following settings:
|
|
The response format. The default response format is Values: |
Response
When you submit a request, the task assigns a unique job ID for the transaction.
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}After the initial request is submitted, you can use the job to periodically check the status of the job and messages as described in Checking job status. Once the job has successfully completed, you use the job to retrieve the results. To track the status, you can make a request of the following form:
https://<raster analysis tools url>/ExtractByMask/jobs/<jobId>When the status of the job request is esri , you can access the results of the analysis by making a request of the following form:
https://<raster analysis tools url>/ExtractByMask/jobs/<jobId>/results/<output parameters>Example usage
The following is a sample request URL for Extract :
https://services.myserver.com/arcgis/rest/services/System/RasterAnalysisTools/GPServer/ExtractByMask/submitJobJSON Response syntax
The response returns the output output parameter, which have properties for parameter name, data type, and value. The content of value is always the item of the output raster dataset and the image service URL.
{
"paramName": <parameter name>,
"dataType": "GPString",
"value": {
"itemId": <item Id>,
"url": <URL>
}
}JSON Response example
{
"paramName": "outputRaster",
"dataType": "GPString",
"value": {
"itemId": "f121390b85ef419790479fc75b493efd",
"url": "https://<server name>/arcgis/rest/services/Hosted/<service name>/ImageServer"
}
}