Scoring Calgary’s Access to Essential Services through Automated ArcGIS Analysis in Python
My name is Harrison Drew, and this is my first ECCE blog post! Today I am sharing the geospatial project I had completed in the Fall 2024 term at the University of Calgary which established a serviceability scoring system for the City of Calgary using geospatial data. This system utilizes automated, standalone ArcPy libraries which are tied with ArcGIS Pro to perform Multi-Criteria Decision Analysis (MCDA) and Service Area Analysis on Calgary’s road and pedestrian networks for scoring the access to essential services that the city has, with added emphasis on sustainable means of transportation.


Background
Serviceability aims to serve as a major indicator for Calgary on its effort to implement sustainable active and public transit options, along with the city’s efforts to promote equal access to essential services, which will rely on the amount of area that features of interest can serve. The essential services in Calgary are defined to include transportation, food, emergency services and safety, and schooling, among others (Government of Canada, 2009). These are also suggested to be placed within the recommended time cutoffs described below for emergency services and the “15-minute city” (Moreno, Allam, Chabaud, Gall, & Pratlong, 2021), with the aim to encourage sustainable urban planning methods and densify the city’s residential districts. Fire services should be placed as close as possible to areas of higher population density or development, as recommended fire response times in Calgary should be within 7 minutes, according to the Calgary Fire Department (CFD) (Chief of Calgary Fire Department, 2022). Additionally, primary care facilities should focus on an ambulance response time within a ten-minute interval, before factoring in any local traffic congestion on major urban roadways and highways (Cabral, et al., 2018). With this, service area features can be created with the ability of this processing to be automated with scripting of geospatial functions. Furthering this analysis, the usage of Multi-Criteria Decision Analysis enables the generation of a specialized and unique criterion which follows the background research provided above.

Methods
Data that was acquired for this project includes the acquisition of shapefiles from open data portals, particularly the Calgary Open Data Portal. The University of Calgary’s Spatial & Numeric Data Services provided a compiled roadway shapefile, mapping every roadway in Calgary, along with their speed limits and prohibited turns at major intersections for network analysis. Similarly, OpenStreetMap data was extracted containing all data labelled as “pedestrian” through OpenStreetMap’s tag system. Other open data acquired included the locations of emergency services for fire and primary care, grocery stores, active transit options in the form of bus stops and LRT stations, and schools, which were split based on elementary, junior high, and senior high grade levels.

Creation of Network Datasets
Network Datasets serve as the backbone for any geospatial network analysis to be performed and allow for the calculation of service areas from facilities, among other geospatial tasks. A road network is set up using the Network Analyst extension while modelling illegal turn restrictions and one-way streets to accurately scale the time cost of a driving mode of transport. This driving time cost also factors in the maximum speed limit of each roadway in Calgary, referenced in the linear dataset for each roadway segment. A shared network dataset for the biking and walking modes of transport is then created using a similar process to the one listed above for the roadway network. For time costs of the network dataset, an appropriate average walk speed of 5.22 km/h is used for the walking time cost (Taylor, Fitzsimons, & Mutrie, 2010), and an appropriate average biking speed of 21 km/h is used for the biking time cost (Selesnic & Kodsi, 2016).

Automation of Service Area Generation Toolset
To generate service areas of all facilities needed for the MCDA with these datasets, the Service Area tool in the ArcGIS geoprocessing toolbox can be used. Generated service areas include a combined area of all generated polygons along with five, ten, and fifteen-minute cutoffs being used. Due to large point datasets being present as facilities, with the demands of the MCDA, the ArcGIS processing can be automated and run standalone through the creation of Python scripts. A pseudocode flowchart in Figure 2 details this process, and the feasibility of automating this with a script.

Utilizing this script and the included algorithms of the Network Analyst extension, a suite of compiled and ready-to-use service area layers can be generated, named, and organized within the project’s geodatabase and workspace. The creation of layer files enables defined, named service areas with appropriate pointers to their generated polygons located in the project’s service area geodatabase. A code snippet is shown below of how this script handles the incorporation of driving turn restrictions specified from a shapefile:
# If Driving, add Restricted Turns (from roadRestrictions shapefile)
if mode == "Driving" :
arcpy.na.AddLocations(
in_network_analysis_layer=layer_object,
sub_layer="Line Barriers",
in_table= roadRestrictions,
field_mappings="Name # #;BarrierType # 1;Attr_Travel_Time # 1;Attr_Length # 1;Shape_Length Shape_Length #",
search_tolerance="5000 Meters",
sort_field=None,
match_type="MATCH_TO_CLOSEST",
append="CLEAR",
snap_to_position_along_network="NO_SNAP",
snap_offset="5 Meters",
exclude_restricted_elements="EXCLUDE",
search_query=None,
allow_auto_relocate="ALLOW"
)
print("Added Driving Restrictions")

Multi-Criteria Decision Analysis Weighting
From the created and exported service area layers, the service area polygons are converted to raster files with a spatial resolution of 1-meter by 1-meter, to ensure minimal area of the service area polygons are lost. For these rasters, a binary scoring system is used where a cell that is within the service area polygon calculated will receive a value of 1, and a cell outside this vicinity will receive a value of 0. With the utilization of the Raster Calculator, these service area rasters can undergo the Multi-Criteria Decision Analysis (MCDA) process and produce a raster calculating the area of Calgary that matches a criterion with assigned weighting per category. A decision tree for this criterion is listed in Figure 3.

The assigned weightings in this criterion place emphasis on walkability of essential services, particularly of transit stops and grocery stores which were identified as critical issues in the background research. Response time of Emergency Services are emphasized in terms of shorter response times, matching the recommended emergency services response time (Cabral, et al., 2018). Walkability of schools is included with a higher assigned weighting, along with a lower scoring and weighted biking service area of schools. Faster walking time to bus stops is weighted higher than other walking times in the transit category, as minimal walk time to a bus stop should be emphasized for an efficient transit network (Noh, Mohamad, & Hamid, 2021). Each grade category is separated to assess and highlight service area differences in distinct types of schooling facilities. Another code snippet is shown below for how the grocery score is calculated within ArcPy from the automatically created service area layers:
# Grocery - 25%
if calcGrocery:
# Load created service area layers for grocery
a = nameGrocery + "_Walking_5min_Raster"
b = nameGrocery + "_Walking_10min_Raster"
c = nameGrocery + "_Walking_15min_Raster"
d = nameGrocery + "_Biking_5min_Raster"
e = nameGrocery + "_Biking_10min_Raster"
f = nameGrocery + "_Biking_15min_Raster"
g = nameGrocery + "_Driving_5min_Raster"
h = nameGrocery + "_Driving_10min_Raster"
i = nameGrocery + "_Driving_10min_Raster"
# Score based on MCDA decision tree weightings and save
output_raster = arcpy.ia.RasterCalculator(
[a, b, c, d, e, f, g, h, i],
["a", "b", "c", "d", "e", "f", "g", "h", "i"],
expression='(((a * 0.5) + (b * 0.3) + (c * 0.2)) * 0.5) + (((d * 0.5) + (e * 0.3) + (f * 0.2)) * 0.3) + (((g * 0.5) + (h * 0.3) + (i * 0.2)) * 0.2)'
)
output_raster.save(r"Grocery_Scored")
# Further steps clip scored raster to specified city bounds
else:
print("Skipping Grocery MCDA")

Results

In Figure 4, the four scores involving Transit, Groceries, Emergency Services, and Schools are combined with equal emphasis to produce a final area statistic and map of Calgary, showing that this generated serviceability score is 55% on average for Calgary. As seen, more serviceable areas of Calgary are clustered around the downtown core and major transit hubs, with easier access to food and schooling services and closer proximity to emergency services. Each major scoring category is shown below, from their respective generated rasters from the automated ArcPy algorithm.
This automated ArcPy algorithm can be imported into ArcGIS Pro as a geoprocessing tool, which takes in only shapefile inputs for the road and pedestrian networks, various facilities to compute service areas for, and the city boundary, allowing for this analysis to be performed on other cities and municipalities that have similar geospatial data available. This algorithm and more detailed results and discussion of the produced serviceability score, as well as larger service area figures, detailed histograms of statistics, and full data references can be viewed in the following GitHub repository:
https://github.com/HD-UCalgary/Serviceability-Score-Calgary-Drew

References
Cabral, E. L., Castro, W. R., Florentino, D. R., Viana, D. d., Junior, J. F., Souza, R. P., . . . Medeiros, A. C. (2018). Response time in the emergency services. Systematic review. Acta Cirúrgica Brasileira. doi:https://doi.org/10.1590/s0102-865020180120000009
Chief of Calgary Fire Department. (2022). Fire & Emergency Response. Retrieved from https://www.calgary.ca/content/dam/www/ca/city-manager/documents/2023-2026-service-plans/fire-emergency-response-service-plan.pdf
Government of Canada. (2009). National Strategy for Critical Infrastructure. Public Safety Canada. Retrieved from https://www.publicsafety.gc.ca/cnt/rsrcs/pblctns/srtg-crtcl-nfrstrctr/index-en.aspx
Greene, R., Devillers, R., Luther, J. E., & Eddy, B. G. (2011). GIS-Based Multiple-Criteria Decision Analysis. Geography Compass, 5(6), 412-432. doi:https://doi.org/10.1111/j.1749-8198.2011.00431.x
Moreno, C., Allam, Z., Chabaud, D., Gall, C., & Pratlong, F. (2021). Introducing the “15-Minute City”: Sustainability, Resilience and Place Identity in Future Post-Pandemic Cities. Smart Cities, 4(1), 93-111. doi:https://doi.org/10.3390/smartcities4010006
Noh, N. M., Mohamad, D., & Hamid, A. H. (2021). Acceptable walking distance accessible to the nearest bus stop considering the service coverage. 2021 International Congress of Advanced Technology and Engineering (ICOTEN). doi:https://doi.org/10.1109/icoten52080.2021.9493435
Selesnic, S., & Kodsi, S. (2016). Bicycling Speeds: A Literature Review. Accident Reconstruction Journal, 12-15. Retrieved from https://www.jsheld.com/uploads/Bicycle-Speed-A-Literature-Review.pdf
Taylor, K. L., Fitzsimons, C., & Mutrie, N. (2010). Objective and subjective assessments of normal walking pace, in comparison with that recommended for moderate intensity physical activity. International Journal of Excercise Science, 3(3), 87-96. Retrieved from https://pmc.ncbi.nlm.nih.gov/articles/PMC4738894/




