HOW TO

Calculate building heights using Arcade in the ArcGIS Enterprise portal and ArcGIS Online

Last Published: January 31, 2025

Summary

Calculating building heights using roof and ground elevation data is an essential task for urban planning, 3D visualization, and infrastructure analysis. 

This article describes the workflow to calculate building heights using roof and ground elevation data with Arcade in the ArcGIS Enterprise portal and ArcGIS Online.

Procedure

  1. Log in to the ArcGIS Enterprise portal or ArcGIS Online and click Content > My Content.
  2. Click the hosted feature layer to open the item page.
  3. Add a new field. Refer to Portal for ArcGIS: Add a field or ArcGIS Online: Add a field for instructions. In this example, a new field, 'Building_Height', is added to the attribute table with two existing fields named 'Roof_Elevation' and 'Ground_Elevation' respectively.
  4. Open the Arcade window. Refer to Portal for ArcGIS: Calculate values for a field from the item page or ArcGIS Online: Calculate values for a field from the item page for instructions.
  5. In the Expression box, specify the following Arcade expression:
    1. Fetch the roof elevation and ground elevation values.
var roof = $feature.Roof_Elevation;
var ground = $feature.Ground_Elevation;
    1. Check for null values to avoid errors.
if (IsEmpty(roof) || IsEmpty(ground)) {
    return null;  // Return null if data is missing
}
    1. Calculate the building height.
var height = roof - ground;
    1. Ensure that there are no negative heights.
if (height < 0) {
    return null;  // Return null for invalid data
}
    1. Return the calculated height in meters.
return Round(height, 2);  // Round to 2 decimal places for precision

The code block below shows the example of the full working script:

var roof = $feature.Roof_Elevation;
var ground = $feature.Ground_Elevation;

if (IsEmpty(roof) || IsEmpty(ground)) {
    return null;  // Return null if data is missing
}

var height = roof - ground;

if (height < 0) {
    return null;  // Return null for invalid data
}

return Round(height, 2);  // Round to 2 decimal places for precision
  1. Click OK.

The image below shows the calculated building heights in meters using roof and ground elevation data.

The calculated building heights in meters using roof and ground elevation data

Article ID: 000034566

Software:
  • ArcGIS Online
  • Portal for ArcGIS
  • ArcGIS Enterprise 11 3
  • ArcGIS Enterprise 11 2
  • ArcGIS Enterprise 11 4

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options