Calculate Field (GeoAnalytics)

Summary

Creates a layer with calculated field values.

Usage

  • This geoprocessing tool is available with ArcGIS Enterprise 10.6 or later.

  • Calculate Field is completed on tables or point, line, or polygon features.

  • Calculate Field will always create a layer. It will not modify the input. You can only calculate values for a single field at a time.

  • You can calculate values for an existing field or for a new field you add by creating a unique field name.

  • Expressions are created using Arcade expressions.

    Learn more about GeoAnalytics Server Arcade expressions with Calculate Field

  • Arcade expressions can be track aware. Track-aware expressions require that data is time enabled and of time type instant and that a track field is specified. To learn more about building track-aware expressions, see Track aware examples.

  • To include a track-aware calculation, you must do the following:

    • Use a layer that is time enabled and of time type instant.
    • Check the Track Aware check box.
    • Select the fields used to identify tracks.

  • Tracks are represented by the unique combination of one or more track fields. For example, if the flightID and Destination fields are used as track identifiers, the features ID007, Solden and ID007, Tokyo would be in two separate tracks, since they have different values for the Destination field.

  • Applying a time interval boundary segments tracks at a defined interval. For example, if you set the time interval boundary to 1 day, starting at 9:00 a.m on January 1, 1990, each track will be truncated at 9:00 a.m. every day and analyzed within that segment. This split is accelerates computing time, as it creates smaller tracks for analysis. If splitting by a recurring time interval boundary makes sense for your analysis, it is recommended for big data processing. Your analysis must be track aware to set a time boundary.

  • In addition to the calculated field, the output may include the following new field types:

    • ObjectID
    • GlobalID—If results are stored in the spatiotemporal data store.
    • datetime—If results are temporally enabled. The new fields are instant_datetime for time type instant, and start_datetime and end_datetime for time type interval.

  • You can improve performance of the Calculate Field tool by doing one or more of the following:

    • Set the extent environment so that you only analyze data of interest.
    • If you are using tracks, split your tracks using the Time Boundary Split parameter.
    • Only select Track Aware if your expression includes a track expression.
    • Use data that is local to where the analysis is being run.

  • This geoprocessing tool is powered by ArcGIS GeoAnalytics Server. Analysis is completed on your GeoAnalytics Server, and results are stored in your content in ArcGIS Enterprise.

  • When running GeoAnalytics Server tools, the analysis is completed on the GeoAnalytics Server. For optimal performance, make data available to the GeoAnalytics Server through feature layers hosted on your ArcGIS Enterprise portal or through big data file shares. Data that is not local to your GeoAnalytics Server will be moved to your GeoAnalytics Server before analysis begins. This means that it will take longer to run a tool, and in some cases, moving the data from ArcGIS Pro to your GeoAnalytics Server may fail. The threshold for failure depends on your network speeds, as well as the size and complexity of the data. It is recommended that you always share your data or create a big data file share.

    Learn more about sharing data to your portal

    Learn more about creating a big data file share through Server Manager

  • Similar analysis can also be completed using the following:

Parameters

LabelExplanationData Type
Input Layer

The input features that will have a field calculated.

Record Set
Output Name

The name of the output feature service.

String
Field Name

The name of the field that will have values calculated. This can be an existing field or a new field name.

String
Field Type

Specifies the field type for the calculated field.

  • StringAny string of characters
  • IntegerWhole numbers
  • Double Fractional numbers
  • Date Date
String
Expression

Calculates values in the field. Expressions are written in Arcade and can include [+ - * / ] operators and multiple fields. Calculated values are applied in the units of the spatial reference of the input unless you are using a geographic coordinate system, in which case they will be in meters.

If the layer is added to the map, the Fields and Helpers filters can be used to build an expression.

Calculator Expression
Track Aware
(Optional)

Specifies whether the expression will use a track-aware expression.

  • Checked—The expression will use a track-aware expression, and a track field must be specified.
  • Unchecked—The expression will not use a track-aware expression. This is the default.

Boolean
Track Fields

One or more fields that will be used to identify unique tracks.

Field
Data Store
(Optional)

Specifies the ArcGIS Data Store where the output will be saved. The default is Spatiotemporal big data store. All results stored in a spatiotemporal big data store will be stored in WGS84. Results stored in a relational data store will maintain their coordinate system.

  • Spatiotemporal big data storeOutput will be stored in a spatiotemporal big data store. This is the default.
  • Relational data storeOutput will be stored in a relational data store.
String
Time Boundary Split
(Optional)

A time span to split the input data into for analysis. 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 split at the beginning of every day. This parameter is only available with ArcGIS Enterprise 10.7 and later.

Time Unit
Time Boundary Reference
(Optional)

The reference time used to split the input data into for analysis. Time boundaries will be created for the entire span of the data, and the reference time does not need to occur at the start. If no reference time is specified, January 1, 1970, is used. This parameter is only available with ArcGIS Enterprise 10.7 and later.

Date

Derived Output

LabelExplanationData Type
Output Table

The new output with calculated values.

Record Set

arcpy.geoanalytics.CalculateField(input_layer, output_name, field_name, field_type, expression, {track_aware}, track_fields, {data_store}, {time_boundary_split}, {time_boundary_reference})
NameExplanationData Type
input_layer

The input features that will have a field calculated.

Record Set
output_name

The name of the output feature service.

String
field_name

The name of the field that will have values calculated. This can be an existing field or a new field name.

String
field_type

Specifies the field type for the calculated field.

  • STRINGThe new field will be of type text.
  • INTEGER The new field will be of type integer.
  • FLOAT The new field will be of type float.
  • DATE The new field will be of type date.
String
expression

Calculates values in the field. Expressions are written in Arcade and can include operators and multiple fields. Calculated values are applied in the units of the spatial reference of the input unless you are using a geographic coordinate system, in which case they will be in meters.

Calculator Expression
track_aware
(Optional)

Specifies whether the expression will use a track-aware expression.

  • TRACK_AWAREThe expression will use a track-aware expression, and a track field must be specified.
  • NOT_TRACK_AWAREThe expression will not use a track-aware expression. This is the default.
Boolean
track_fields
[track_fields,...]

One or more fields that will be used to identify unique tracks.

Field
data_store
(Optional)

Specifies the ArcGIS Data Store where the output will be saved. The default is SPATIOTEMPORAL_DATA_STORE. All results stored in a spatiotemporal big data store will be stored in WGS84. Results stored in a relational data store will maintain their coordinate system.

  • SPATIOTEMPORAL_DATA_STOREOutput will be stored in a spatiotemporal big data store. This is the default.
  • RELATIONAL_DATA_STOREOutput will be stored in a relational data store.
String
time_boundary_split
(Optional)

A time span to split the input data into for analysis. 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 split at the beginning of every day. This parameter is only available with ArcGIS Enterprise 10.7 and later.

Time Unit
time_boundary_reference
(Optional)

The reference time used to split the input data into for analysis. Time boundaries will be created for the entire span of the data, and the reference time does not need to occur at the start. If no reference time is specified, January 1, 1970, is used. This parameter is only available with ArcGIS Enterprise 10.7 and later.

Date

Derived Output

NameExplanationData Type
output_table

The new output with calculated values.

Record Set

Code sample

Calculate Field example 1 (Python window)

The following Python window script demonstrates how to use the CalculateField tool.

#-------------------------------------------------------------------------------
# Name: CalculateField.py
# Description: Calculate the mean of the 3 most recent speed measurements in hurricane tracks

# Requirements: ArcGIS GeoAnalytics Server

# Import system modules
import arcpy

# Set local variables
inFeatures = "https://example.arcgis.com/arcgis/rest/services/Hurricanes/FeatureServer/0"
newField = "MeanSpeed3"
outFS = "HurricaneTracks_Mean"
trackIdentifier = "Name"
calcExpression = "Average($track.field['WINDSPEED'].history(-3))"

# Execute Reconstruct Tracks
arcpy.geoanalytics.CalculateField(inFeatures, outFS, newField, "Double", 
                                  calcExpression, True, trackIdentifier)

Environments

Special cases

Output Coordinate System

The coordinate system that will be used for analysis. Analysis will be completed in the input coordinate system unless specified by this parameter. For GeoAnalytics Tools, final results will be stored in the spatiotemporal data store in WGS84.

Licensing information

  • Basic: Requires ArcGIS GeoAnalytics Server
  • Standard: Requires ArcGIS GeoAnalytics Server
  • Advanced: Requires ArcGIS GeoAnalytics Server

Related topics