Using the Python TRACC Library for Urban Transportation Accessibility Analysis
This article introduces the open‑source Python library TRACC, explains its accessibility metrics, shows how to install it, prepare destination and travel‑cost data, and provides step‑by‑step code examples for calculating potential, passive, and minimum‑travel‑cost accessibility in a city such as Boston.
As cities grow, transportation accessibility becomes a key indicator for urban planning; the TRACC library offers powerful tools to load, process, and analyze transport data for evaluating accessibility across regions.
TRACC Overview – an open‑source Python package focused on urban transport accessibility, combining land‑use data (e.g., jobs, services) with pre‑computed travel‑cost matrices to generate three main metrics: potential accessibility, passive accessibility, and minimum travel‑cost accessibility.
Key Features
Estimate travel costs within an area
Fill gaps in travel‑cost matrices using spatial weight matrices
Generate impedance functions (cumulative, linear, negative exponential, inverse power)
Compute generalized costs
Installation pip install tracc Data Preparation – two datasets are required: destination data (e.g., employment counts from LEHD) and travel‑cost data (e.g., public‑transport travel‑time matrix for Boston).
Analysis Workflow
Load data
# Load destination data
dfo = tracc.supply(
supply_df=pd.read_csv("examples/test_data/boston/destination_employment_lehd.csv"),
columns=["block_group_id", "C000"] # C000 = total jobs
) # Load travel‑cost data
dft = tracc.costs(
pd.read_csv("examples/test_data/boston/transit_time_matrix_8am_30_06_2020.zip", compression='zip')
)
dft.data.time = dft.data.time / 60 # convert seconds to minutesCompute impedance function
dft.impedence_calc(
cost_column="time",
impedence_func="cumulative",
impedence_func_params=45,
output_col_name="fCij_c45",
prune_output=False
)Set up accessibility object
acc = tracc.accessibility(
travelcosts_df=dft.data,
supply_df=dfo.data,
travelcosts_ids=["o_block", "d_block"],
supply_ids="block_group_id"
)Calculate accessibility
dfa = acc.potential(
opportunity="C000",
impedence="fCij_c45"
)The first five rows of dfa show, for example, that from block group 250056001001 a person can reach 4,061 jobs within a 45‑minute travel time.
These results can be visualized in Python, QGIS, or other GIS tools to help planners understand travel patterns and improve resource allocation.
TRACC thus provides a convenient, extensible framework for transportation accessibility analysis, supporting customized studies and visualizations for urban planners and policymakers.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
