A toolkit for weaving transit data into beautiful, meaningful maps.
"Magga" carries dual meaning - a loom (ಮಗ್ಗ) in Kannada that weaves intricate patterns, and "path" (मग्ग) in Pali Buddhism, referring to the noble path to enlightenment. This duality perfectly captures our mission: just as a loom weaves threads into beautiful patterns, we weave transit routes into readable maps. And just as the Noble Eightfold Path guides beings toward enlightenment, accessible public transit guides communities toward sustainability and equity.
In cities where most of humanity now lives and where the majority of CO2 emissions occur, public transit serves as a crucial path toward:
- Reducing environmental impact and fighting climate change
- Connecting people to opportunities and lifting communities from poverty
- Creating more livable, sustainable urban spaces
- Weaving the social fabric that binds communities together
- Generate both geographic and schematic transit maps
- Interactive visualization tools for exploring transit networks
- Flexible filtering and subsetting of GTFS data
- Customizable styling and appearance
- Automated text size adjustment for optimal readability
- Support for various transit modes (bus, tram, rail, etc.)
git clone --recurse-submodules https://github.com/pvnkmrksk/magga.git
cd magga
mkdir build && cd build
cmake ..
make -jOptionally install system-wide:
make installGenerate a transit map from GTFS data:
./process_transit_map.sh input.zipFilter specific routes and stops:
./process_transit_map.sh input.zip --stops "stop1,stop2" --routes "1,2,3"Create an interactive web visualization:
python gtfs_map_viewer.py input.zipFor more control, you can run the pipeline tools individually:
# Create a filtered subset of GTFS data
python gtfs_subset_cli.py input.zip --stops "3ie,sw" -m 15 -o subset.zip
# Generate maps using the pipeline
gtfs2graph -m bus subset.zip | \
topo --smooth 20 -d 150 | \
loom | \
octi | \
transitmap -l --tight-stations --render-dir-markers > output.svg
# For geographic maps, skip octilinearization
gtfs2graph -m bus subset.zip | \
topo --smooth 20 -d 150 | \
loom | \
transitmap -l --tight-stations --render-dir-markers > geographic.svgEach step in the pipeline serves a specific purpose:
gtfs2graph: Converts GTFS to a graph formattopo: Handles overlapping edges and station clusteringloom: Optimizes line arrangementsocti: Creates schematic (octilinear) layoutstransitmap: Renders the final SVG with labels and styling
The main pipeline tool that automates the entire process from GTFS to final maps. It handles:
- GTFS subsetting and filtering
- Geographic and schematic map generation
- Automatic text size adjustment
- Output organization
A tool for creating focused subsets of GTFS data based on:
- Specific stops or routes
- Minimum trip counts
- Pattern matching for route names
Interactive web visualization tool featuring:
- Route visualization with frequency-based styling
- Stop visualization with customizable metrics
- Detailed information popups
- Multiple color scheme options
Post-processing tool for optimizing text sizes and spacing in generated maps.
Core requirements:
cmakegcc >= 5.0(orclang >= 3.9)- Python 3.6+
Optional dependencies for enhanced functionality:
libglpk-devcoinor-libcbc-devgurobilibzip-devlibprotobuf-dev
You can also use the tools via Docker:
docker build -t magga .
docker run -i magga <TOOL>For Gurobi optimization, mount your license:
docker run -v /path/to/gurobi:/gurobi magga <TOOL>Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details.
This work builds upon the foundational research and implementation of the LOOM project by Hannah Bast, Patrick Brosi, and Sabine Storandt. Their groundbreaking work in transit map generation is documented in:
- Efficient Generation of Geographically Accurate Transit Maps (SIGSPATIAL 2018)
- Metro Maps on Octilinear Grid Graphs (EuroVis 2020)
- Metro Maps on Flexible Base Grids (SSTD 2021)
We are grateful to stand on the shoulders of these giants in our mission to make transit networks more accessible and understandable.
ಪವನ ಕುಮಾರ | Pavan Kumar, PhD
@pvnkmrksk
- Procedural name shortening
- Implement intelligent abbreviation rules for common words (Street → St, Road → Rd)
- Handle multilingual name variants
- Preserve uniqueness while shortening
- Configure maximum name length threshold
- Lat-long based stop merging
- Merge stops with identical names within configurable distance threshold
- Preserve all stop IDs for routing purposes
- Calculate centroid for merged stop placement
- Handle edge cases with partial name matches
- Distance-based network subsetting
- Implement radius-based filtering from focus stop(s)
- Support multiple foci with union/intersection options
- Include connecting routes between included stops
- Preserve network connectivity
- Pattern-based route exclusion
- Support glob patterns for route exclusion (e.g., "Night*", "X*")
- Allow regex patterns for complex matching
- Implement whitelist/blacklist functionality
- Preserve route dependencies
- Junction detection and labeling
- Identify major junctions based on:
- Number of intersecting routes
- Passenger volume/frequency
- Geographic importance
- Smart label placement for major junctions
- Configurable importance thresholds
- Option to show only major junction labels
- Identify major junctions based on:
- Junction-focused display
- Implement toggle for junction-only view
- Scale junction markers by importance
- Smart label density control
- Maintain visual hierarchy