- URL:
- https://<geoanalytics-url>/CalculateField
- Methods:
GET
- Version Introduced:
- 10.6
Description
The Calculate
operation works with a layer to create and populate a new field or edit an existing field. The
output is a new feature service that is the same as the input features, with the newly calculated values.
Request parameters
Parameter | Details |
---|---|
| The input features that will have a field added and calculated. Syntax: As described in Feature input, this parameter can be one of the following:
REST examples
|
| A string representing the name of the new field. If the name already exists in the dataset, a numeric value will be appended to the field name. REST Example
|
| The type for the new field. Values: REST examples
|
| An Arcade expression used to calculate the new field values. You can use any of the Date, Logical, Mathematical, or Text functions available with Arcade expressions. REST examples
|
| A Boolean value denoting if the expression is track-aware. Values: REST examples
|
| The fields used to identify distinct tracks. There can be multiple REST examples
|
|
A time boundary allows you to analyze values within a defined time span. For example, if you use a time boundary of 1 day, starting on January 1, 1980, tracks will be analyzed one day at a time. The time boundary parameters are only applicable if the analysis is REST examples
|
|
The unit applied to the time boundary. REST examples
|
|
A date that specifies the reference time to align the time boundary to, represented in milliseconds from epoch. The default is January 1, 1970, at 12:00 a.m. (epoch time stamp 0). This option is only available if the REST examples
|
|
The task will create a feature service of the results. You define the name of the service. REST examples
|
|
The
Syntax:
|
|
The response format. The default response format is Values: |
Example usage
Below is a sample request URL for Calculate
:
https://webadaptor.domain.com/server/rest/services/System/GeoAnalyticsTools/GPServer/CalculateField/submitJob?inputLayer={"url":"https://webadaptor.domain.com/server/rest/services/Hurricane/hurricaneTrack/0"}&fieldName=MyNewField&dataType=Integer&expression=$feature["Field1"] + abs($feature["Field2"])&trackAware=false&trackFields&timeBoundarySplit=2&timeBoundarySplitUnit=Hours&timeBoundaryReference=946684800000&outputName=myOutput&context={"extent":{"xmin":-122.68,"ymin":45.53,"xmax":-122.45,"ymax":45.6,"spatialReference":{"wkid":4326}}}&f=json
Response
When you submit a request, the service assigns a unique job ID for the transaction.
Syntax:
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}
After the initial request is submitted, you can use job
to periodically check the status of the job and messages as described in Check job status. Once the job has successfully completed, use job
to retrieve the results. To track the status, you can make a request of the following form:
https://<analysis url>/CalculateField/jobs/<jobId>
Access results
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://<analysis-url>/CalculateField/jobs/<jobId>/results/output?token=<your token>&f=json
Response | Description |
---|---|
|
The result has properties for parameter name, data type, and value. The contents of
|