How can I use field values to specify distance of NA Service Area Buffers?

05-06-2019 11:47 PM
New Contributor III


I am using ArcGIS Pro 2.3.2 through Jupyter Notebook

I am trying to create a Service Area using Network Analysis (i.e., MakeServiceAreaAnalysisLayer_na) based on predefined distances identified in a field of the input table (i.e., field named 'cut_off'). I have created a field with the cutoff values in them formatted as '[2, 3, 4]'. Each feature in the point feature class has a different value in the cutoff value field. From the help files I can see that "This default cutoff value can be overridden on a per-facility basis by specifying individual break values in the facilities sublayer." Unfortunately I cannot find any example of how to do this. I have developed some code but it doesn't seem to override the default distances of "5, 10, 15" minutes. 

Here is the example code that doesn't seem to work:

#Import system modules
import arcpy
import os, datetime
import numpy as np
#Check out Network Analyst license if available. Fail if the Network Analyst license is not available.
if arcpy.CheckExtension("network") == "Available":
    raise arcpy.ExecuteError("Network Analyst Extension license is not available.")

#Set environment settings
output_dir = r"C:\afclark82\ChildCare_Version2"
input_gdb = os.path.join(output_dir,"Default.gdb")
travel_mode = "[Meters, DriveTime]"
print("Environment settings set")

#The NA layers data will be saved to the workspace specified here
arcpy.env.workspace = input_gdb
arcpy.env.overwriteOutput = True

#Set local variables
network = os.path.join(input_gdb, "Network", "NetworkDataSet")
facilities = r"Locations\ChildCareLocations"
output_layer_file = os.path.join(output_dir, "SrvcAreasLyr.lyrx")

#verifying that the feature dataset "shortestpaths" is already in the geodatabase
if arcpy.Exists("ShortestPaths")==False:
   arcpy.CreateFeatureDataset_management(input_gdb, "ShortestPaths")

if len(arcpy.ListFields(facilities,"cutoffs"))==0: 
    arcpy.AddField_management(facilities, "cutoffs", "TEXT"), "cutoffs", '"[{}, {}, {}]".format(!Per50!,!Per62!,!Per75!)', "PYTHON3", None)
print("Create a new service area")
#Create a new service area layer.
result_object =,output_layer_file,travel_mode,"FROM_FACILITIES",cutoffs="breaks_minutes",polygon_detail="HIGH",geometry_at_overlaps="OVERLAP")

#Get the layer object from the result object. The service area layer can
#now be referenced using the layer object.
layer_object = result_object.getOutput(0)

#Get the names of all the sublayers within the service area layer.
sublayer_names =
print("Store sublayers")

#Stores the layer names that we will use later
facilities_layer_name = sublayer_names["Facilities"]
polygons_layer_name = sublayer_names["SAPolygons"]

#The input data has a field for CentreID that we want to transfer to
#our analysis layer. Add the field, and then use field mapping to transfer
#the values., facilities_layer_name,"CentreID", "TEXT"), facilities_layer_name,"cutoffs", "TEXT")
field_mappings =,facilities_layer_name)
field_mappings["CentreID"].mappedFieldName = "CentreID"
field_mappings["cutoffs"].mappedFieldName = "cutoffs"
print("field mapping")

#Load the day care centres as facilities., facilities_layer_name, facilities,field_mappings, "")

# Add fields to the output Polygons sublayer for later use., polygons_layer_name,"CentreID", "TEXT"), polygons_layer_name,"cutoffs", "TEXT")

#Get sublayers to work with later
facilities_sublayer = layer_object.listLayers(facilities_layer_name)[0]
polygons_sublayer = layer_object.listLayers(polygons_layer_name)[0]

#Get the Service Area Layers solver properties. This can be used to
#set individual properties later without re-creating the layer.
solver_properties =
print ("added locations")
0 Kudos
2 Replies
by Anonymous User
Not applicable

Hey Andrew - I've been playing around with this idea myself. Take a look at this: Service area analysis layer—ArcGIS Pro | Documentation - Breaks_[Cost] section

"You can store different polygon break values for each service area facility in the Breaks_[Cost] field"

You may want to calculate the Breaks_[Cost] field you have with the custom break values using the field calculator. This should overwrite the default settings.

0 Kudos
Esri Regular Contributor

You have to format it as a space-separated string.  So, if you want [2, 3, 4], you have to populate the Breaks_[Cost] field with "2 3 4".  For the sake of an example, if you wanted [1.5, 4.5, and 10.2], you would write "1.5 4.5 10.2".

0 Kudos