HOW TO

Display the total length of lines within a polygon in a pop-up based on field values using Arcade in ArcGIS Pro

Last Published: August 18, 2023

Summary

In ArcGIS Pro, calculating the total length of lines within a polygon is useful for spatial analysis of an area in a map.

In this article, an Arcade expression is used to calculate the total length of the active pipes within a factory based on their status and the result is then displayed in a pop-up. The image below displays the attribute table of the line feature layer representing the pipes within the factory.

The attribute table of the line feature layer.

Procedure

  1. Open the ArcGIS Pro project.
  2. Right-click the polygon layer in the Contents pane and click Configure Pop-ups to open the Configure Pop-ups pane.
  3. Click Expressions to create an Arcade expression to use in the pop-up.
  4. In the Expressions pane, click New to add an expression.
  5. In the Expression Builder dialog box, specify a title to provide a name for the pop-up. In this example, the title is ‘Length of active pipes'.
  6. In the Expression section, specify the Arcade expression.
Length(Contains($feature, Filter(FeaturesetByName($datastore, '<feature_name>', ['*']), "<field_name> = '<field_value>'")))
  1. Replace <feature_name> with the name of the line layer. In this example, ‘Pipes’ is used.
  2. Replace <field_name> with the name of the field containing the field values. In this example, ‘Status’ is used.
  3. Replace <field_value> with the value of the line features required for the calculation. In this example, ‘In service’ is used.
  1. Click OK.
Arcade expression in the Expression Builder window
  1. In the Configure Pop-ups pane, select the Fields element. Click the Edit pop-up element Edit pop-element icon button to open the Field Options pane.
  2. Specify a title or a caption and uncheck the Only use visible fields and Arcade expressions check box. In this example, the title is ‘Total length of active pipes in the factory’.
  3. Check the newly created field with the Arcade expression check box to display the total length of lines within the polygon.
  4. Click Back to apply the changes.
Configure Pop-ups pane with configuration

The image below displays the total length of active pipes in the factory in the pop-up in ArcGIS Pro.

Map displaying a pop-up of the active pipe lines in a polygon representing a factory

Article ID:000029908

Software:
  • ArcGIS Pro 3 1
  • ArcGIS Pro 3 0
  • ArcGIS Pro 2 8 x
  • ArcGIS Pro 2 7 x
  • ArcGIS Pro 2 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic