Indicates whether the number of edge source features from the specified network dataset that are intersected by the features within the specified feature layer is less than or equal to the specified cutoff. If the number of intersecting features is less than or equal to the allowed limit, the function returns True. If the number of intersecting features exceeds the allowed limit, the function returns False. The function is useful to restrict the number of features that can be loaded as line or polygon barriers into a network analysis layer.


The function is used to restrict the number of features that can be loaded into sublayers, especially line and polygon barriers, of network analysis layers. While loading polygon barriers, the software needs to determine the intersection between the polygon features and the edge sources from the network dataset. This process can be slow if the polygon features intersect many edge sources such as a state or county boundary. For example, while authoring a geoprocessing service that performs routing analysis, you may want to restrict the features that are loaded as polygon barriers. To have a reasonable service response time, you could restrict loading of polygon barriers if they intersect more than 5,000 edge source features from the network dataset. This function can be easily used to perform such a check.


CheckIntersectingFeatures (network_dataset_path, feature_layer, {cutoff})
ParameterExplanationData Type

The input network dataset, referenced as a catalog path, network dataset layer object, or layer name. Each edge source in this network dataset will be considered while performing the check.


A variable that references a catalog path, feature set, layer object, or layer name containing the features you want to test for intersection with the network dataset edges. Any selection set or definition query present on the Layer object is honored and can be used to specify only a subset of features.


An integer value used as a cutoff while performing the check.

(The default value is 5000)

Return Value
Data TypeExplanation

If the specified features that intersect the edge source features from the network dataset are less than or equal to the cutoff value, the function returns True; otherwise, it returns False.

Code sample

CheckIntersectingFeatures example (workflow)

The example shows how to find the best route between some store locations considering weather conditions as slowdown areas. It illustrates how to use the CheckIntersectingFeatures function to test that the weather polygons to be used as polygon barriers do not intersect more than a specified number of edge source features from the network dataset. If the condition is not met, the script raises a standard error message.

import arcpy
from arcpy import env
import os

#Check out the Network Analyst extension license

#Set environment settings
output_dir = "C:/Data"
#The NA layer's data will be saved to the workspace specified here
env.workspace = os.path.join(output_dir, "Output.gdb")
env.overwriteOutput = True

#Set up variables
network = "C:/Data/SanFrancisco.gdb/Transportation/Streets_ND"
polygon_barriers = "C:/Data/SanFrancisco.gdb/Analysis/WeatherSlowDownAreas"
stops = "C:/Data/SanFrancisco.gdb/Analysis/Stores"
cutoff = 3000

#Make a feature layer from the catalog path to the shapefile
barriers_layer =,

#Check if fewer than 3000 edge features are intersected by barrier features
if, barriers_layer, cutoff):
    #Proceed with creating a new route layer and loading the barriers
    route_layer =, "WeatherRoute",
                                         "Driving Time").getOutput(0)
    #Get na class names based on the layer
    naClasses =, "INPUT")
    #Create field mappings for loading barriers as scaled cost polygon barriers
    #with a slow down of 40%
    fieldMappings =,
    fieldMappings["BarrierType"].defaultValue = 1
    #Figure out the layer's impedance attribute
    solver_props =
    impedance = solver_props.impedance
    fieldMappings["Attr_" + impedance].defaultValue = 1.4
    #Load weather polygons as slow down barriers, naClasses["PolygonBarriers"],
                          polygonBarriers, fieldMappings)
    #Load stops, naClasses["Stops"], stops)
    #Solve the route

    #Return a standard error message if the test fails.
    arcpy.AddIDMessage("ERROR", 30095, "Polygon Barriers", cutoff)