This project is a Beijing Metro route query and editing system, supporting route planning, fare calculation, and map visualization. It includes a GUI for interactive queries and tools for editing and preprocessing metro data.
- Route Query: Find the shortest time, least transfers, or shortest distance between stations.
- Fare Calculation: Calculate ticket prices based on the selected route.
- Map Visualization: Visualize metro lines and stations using a graphical interface.
- Data Editing: Add or delete metro lines and stations, update coordinates.
- Data Preprocessing: Convert raw metro data into optimized formats for fast querying.
main.py: Entry point for the GUI application.gui.py: Implements the map viewer and user interface using Matplotlib.metro.py: Core logic for metro data structures, route finding, and fare calculation.pre_process.py: Preprocesses raw metro data and builds adjacency lists.edit.py: Command-line tool for editing metro lines and station data.beijing.json,metro.json,data.json: Metro data files.coordinate.csv: Station coordinates.
- Python 3.x
matplotlibgeopandas
Install dependencies with:
pip install matplotlib geopandaspython main.pypython edit.pyFollow the prompts to add or delete lines and update station coordinates.
Preprocessing is automatically triggered after editing data.
beijing.json: Raw map data.metro.json: Editable metro line and station data.data.json: Preprocessed data for fast queries.coordinate.csv: Station coordinates (longitude, latitude).