- URL:
- https://<rasteranalysistools-url>/CalculateImageServiceField
- Methods:
GETPOST- Version Introduced:
- 12.0
Description
The Calculate operation calculates the value of a field for an image collection. The value is calculated using the provided SQL or Arcade expression. The calculation can only be applied to one field per request; the field must already exist and must be editable. Existing field values will be overwritten.
For Arcade calculations, field names must be prefixed with $feature., such as $feature.fieldname. The Calculate operation's arcade expressions use the Field Calculation Arcade profile. An Arcade profile is a context in which an Arcade expression is evaluated and understood. When an Arcade expression is evaluated, the return value is cast to the field type of the output value.
The Calculate operation should be used when you want to add, modify, or remove information from an image collection.
Request parameters
| Parameter | Details |
|---|---|
(Required) | This is the output image collection (mosaic dataset) name or url. The image service must exist before you perform calculate field operations. Syntax: JSON object supports three keys: itemId, url and uri. They keys are case sensitive. Example: |
(Required) | The field that will be updated with the new calculation. Syntax: A String (field name) that needs to be calculated. Example: |
(Required) | A simple calculation expression to create a value that will populate the selected rows. Syntax: A JSON object representing the expression to be applied Example: |
(Required) | Specifies the type of expression that will be used. When set as Values: |
(Optional) | Defines the mosaic dataset's properties:
|
| The response format. The default format is Values: |
Example usage
The following is a sample request URL for the Calculate operation:
https://organization.example.com/<context>/rest/services/System/RasterAnalysisTools/GPServer/CalculateImageServiceField/submitJob?imageCollection={"itemId":"a0be5da72d534a7bb8860c026afa6e61"}&field=SensorName&expression={"expression":"Split($feature.Name, '_')[0]"}&expressionType=ARCADE&context={"allowedTransmissionField": ["Name", "MinPS", "MaxPS", "LowPS", "HighPS", "Tag", "GroupName", "ProductName", "CenterX", "CenterY", "ZOrder", "Shape_Length", "Shape_Area", "SensorName"]}&f=pjsonJSON Response example
The response returns the output output parameter, which has properties for parameter name, data type, and value. The content of the value is always the output raster dataset’s itemId and image service URL.
{
"paramName": "outputCollection",
"dataType": "GPString",
"value": [{
"url": "https://<server url>/arcgis/rest/services/Hosted/Hosted_mosaic_image_collection/ImageServer"
}]
}