☀Everything Automotive, Tested & Explained Stories

ArcGIS Pro: Calculate Field with Arcade Examples

By

ArcGIS Pro, a powerful desktop GIS application, provides an extensive suite of tools to manage, analyze, and visualize spatial data. One of its standout features is its ability to perform calculations on fields, transforming and enriching data in real-time. The Arcade expression language is at the heart of these calculations, offering a wide range of functions to create sophisticated calculations. Let's delve into some practical examples of how you can leverage Arcade to perform field calculations in ArcGIS Pro.

Before we dive into the examples, let's ensure that our data is ready. You should have your data loaded into ArcGIS Pro, and the fields you want to calculate should be selected or edited.

Calculating New Fields

One common use of Arcade is creating new fields based on existing ones. This is useful when you want to derive new data from your existing attributes without affecting the original data.

ArcGIS Pro Tutorial: Create Rainfall Map using Kriging Interpolation Method in ArcGIS Pro
ArcGIS Pro Tutorial: Create Rainfall Map using Kriging Interpolation Method in ArcGIS Pro
How to Use ArcGIS Pro to Assess Landslide Susceptibility
How to Use ArcGIS Pro to Assess Landslide Susceptibility
QGIS vs ArcGIS Pro
QGIS vs ArcGIS Pro

To illustrate, let's say we have a point feature class of buildings with 'FloorArea' and 'NumBedrooms' fields, and we want to calculate a new field 'ValuePerSquareFoot'.

Example 1: Division Calculation

We can use the divide function in Arcade to perform this calculation. The Arcade expression would look like this:

a computer screen showing an image of a city with lots of different colored blocks and shapes
a computer screen showing an image of a city with lots of different colored blocks and shapes
ArcGIS Urban 101 – Projects and Plans
ArcGIS Urban 101 – Projects and Plans
A Complete Beginner's Guide to ArcGIS Desktop (Part 3)
A Complete Beginner's Guide to ArcGIS Desktop (Part 3)
```html NumBedrooms / FloorArea ```

In ArcGIS Pro, you would paste this expression into the 'cible' field's expression builder, choose the appropriate data type (like 'Double'), and click 'OK'.

Example 2: String Concatenation

Arcade also supports string concatenation, which is handy when you want to combine text from different fields. For instance, if we have 'BuildingName' and 'UnitNumber' fields, we can create a new 'FullAddress' field with the following Arcade expression:

```html BuildingName + ' - Unit ' + UnitNumber ```

This will return 'Example Tower - Unit 101' if 'BuildingName' is 'Example Tower' and 'UnitNumber' is 101.

Wildlife Analysis in ArcGIS Pro: Using Kernel Densities to estimate Home Ranges and Core Areas
Wildlife Analysis in ArcGIS Pro: Using Kernel Densities to estimate Home Ranges and Core Areas
How to Add Data from ArcGIS Online to QGIS
How to Add Data from ArcGIS Online to QGIS
Understanding ArcGIS Pro
Understanding ArcGIS Pro
My Road to Pro: A guide to getting up and running with ArcGIS Pro in a 'Redlands Minute'
My Road to Pro: A guide to getting up and running with ArcGIS Pro in a 'Redlands Minute'
Client Challenge
Client Challenge
Converting ArcGIS Layers to Google Earth (KML) - Duke Libraries Center for Data and Visualization Sciences
Converting ArcGIS Layers to Google Earth (KML) - Duke Libraries Center for Data and Visualization Sciences

Conditional Statements

Arcade supports conditional statements using if-else syntax, allowing you to create rules and definitions in your data. Let's see how we can use this to categorize buildings based on their floor area.

We want to create a new field 'SizeCategory' that categorizes buildings as 'Small', 'Medium', or 'Large' based on their floor area. Assume 'Small' is less than 1000 sq ft, 'Medium' is between 1000 and 5000 sq ft, and 'Large' is 5000 sq ft or more.

Example 3: If-Else if-Else Statement

The Arcade expression for this would be:

Mini curso práctico de ArcGIS 10 en español
Mini curso práctico de ArcGIS 10 en español
Top 5 Tips & Tricks for ArcGIS Pro - Change Your GIS Life!
Top 5 Tips & Tricks for ArcGIS Pro - Change Your GIS Life!
a poster with instructions for geoprocesing overlay and extra tools
a poster with instructions for geoprocesing overlay and extra tools
Geospatial Tools | ArcGIS Pro Features & License Levels
Geospatial Tools | ArcGIS Pro Features & License Levels
```html if(FloorArea < 1000, 'Small', if(FloorArea > 5000, 'Large', 'Medium')) ```

This expression uses nested if-else statements to define the size categories based on the 'FloorArea' field.

Example 4: Switch Statement

Alternatively, you can use the switch statement to achieve the same result in a more concise way:

```html switch( true, FloorArea < 1000, 'Small', FloorArea > 5000, 'Large', 'Medium') ```

In both examples, the new field 'SizeCategory' will be populated based on the rules defined in the Arcade expression.

With these examples, you've seen how Arcade can be used to perform various kinds of field calculations in ArcGIS Pro. From simple divisions to conditional statements, Arcade offers a wealth of functionalities to help you manage and derive insights from your data. Now, it's your turn to explore and experiment with Arcade to unlock its full potential for your specific use cases.