HOW TO

Conditionally determine if a feature class is located within a specified distance from another feature class using Arcade in ArcGIS Pro

Last Published: October 7, 2024

Summary

When there are many different feature classes grouped closely among each other in ArcGIS Pro, it is difficult to determine if these feature classes are located within a specific distance.

This article describes the workflow to conditionally determine if a feature class is located within a specified distance from another feature class using Arcade in ArcGIS Pro.

Procedure

In this example, a point feature class and a line feature class are used.

  1. Open the Calculate Field tool on the attribute table. Refer to ArcGIS Pro: Access the Field Calculator for more information.
  2. For Input Table, ensure the desired point layer is selected in the drop-down list.
  3. Specify a name for Field Name.
  4. For Expression Type, select Arcade in the drop-down list.
  5. Specify the following Arcade expression in the Expression section. Replace '<lineName>' with the name of the line feature class.
    1. Load the line feature class.
var lines = FeaturesetByName($datastore, "<lineName>")
    1. Return the results if the points are located within the specified distance from the line feature. 
return IIF(Count(Intersects(Buffer($feature, <numericValue>, "<unit>"), lines)) > 0 , "Yes", "No")

The code below shows the example of the full working script.

var lines = FeaturesetByName($datastore, "Line1")
return IIF(Count(Intersects(Buffer($feature, 10, "kilometers"), lines)) > 0 , "Yes", "No")
  1. Click OK.

The image below shows the example of the full working script in the Calculate Field dialog box.

The example of the full working script

The image below shows the result of 'Yes' or 'No' if the points are within a specified distance of a line.

The results return a 'Yes' if the points are within the specified distance of the lines and 'No' if it is not

Article ID: 000030048

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

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

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options