Combining GTFS and OSM Data to Identify Critical Infrastructure
This project analyzes Krakow's transport network by combining:
- GTFS data: Public transport schedules and routes
- OSM data: Street network infrastructure
The goal is to identify critical nodes and segments using graph centrality metrics and to visualize the integrated network.
- GTFS Data Loading & Preprocessing: Reads and prepares public transport data.
- OSM Data Integration: Downloads and processes Krakow’s street network.
- Segment Utilization Analysis: Calculates and visualizes the busiest and least-used segments.
- Network Graph Construction: Builds a stop-to-stop directed graph and computes centrality measures.
- Multimodal Network Integration: Merges public transport and road networks for holistic analysis.
- Centrality Analysis: Computes eigenvector, PageRank, betweenness, and degree centralities for nodes and edges.
- Critical Node Identification: Highlights the most important nodes for network resilience.
- Interactive Visualizations: Generates interactive maps and charts (HTML output) for all key analyses.
.
├── krakow_transport_analysis.ipynb # Main analysis notebook
├── gtfs/ # GTFS data (unzipped)
├── gtfs.zip # GTFS data (zipped, optional)
├── results/
│ ├── gtfs_graph/ # GTFS-based analysis outputs
│ ├── osm_graph/ # OSM-based analysis outputs
│ └── merged_gtfs_osm/ # Multimodal network outputs
├── img/ # Images and figures
└── README.md # This file
- Python 3.8+
- Recommended packages:
- pandas, numpy, networkx, osmnx, geopandas, matplotlib, plotly, folium, shapely, scipy, joblib
Install all dependencies with:
pip install -r requirements.txtOr manually:
pip install pandas numpy networkx osmnx geopandas matplotlib plotly folium shapely scipy joblib- Place your GTFS zip file as
gtfs.zipin the project root. - The notebook will extract it automatically to
gtfs/if not already present.
- Open
krakow_transport_analysis.ipynbin Jupyter Notebook or VS Code. - Run all cells step by step.
- Outputs (interactive maps, charts, CSVs) will be saved in the
results/subfolders.
-
Load and Prepare GTFS Data
Reads GTFS files, preprocesses shapes and trips. -
Analyze Transit Operations
Counts trips per route/direction, visualizes busiest lines. -
Preprocess Route Shapes
Converts shape points into route segments. -
Calculate Segment Utilization
Aggregates trip counts per road segment, identifies top and bottom segments. -
Build Stop Network Graph
Constructs a directed graph of stops, computes centrality measures. -
Integrate OSM Street Data
Downloads Krakow’s road network, converts to graph. -
Create Multimodal Network
Merges GTFS and OSM graphs, assigns flow capacities. -
Assigning Flow Capacities
Assigns flow capacities to network edges based on road type and bus frequency. -
Multimodal Centrality Analysis
Calculates eigenvector, PageRank, betweenness, and degree centralities for nodes and edges. -
Critical Node Analysis
Identifies and visualizes the most important nodes for network resilience.
- Interactive HTML maps: In
results/, e.g.2_trips_per_route_direction.html,4_5_segment_trip_distribution_interactive.html, etc. - CSV files: Centrality measures and statistics.
- Plots and charts: For all major steps.
- Some output HTML files may be large (>50MB) and are best viewed locally.
- For large files, consider using Git LFS.
- All code is modular and can be adapted for other cities or datasets.
MIT License
Created as part of a master's project on urban transport network analysis.

