Skip to content

playeriv65/metro

Repository files navigation

Beijing Metro Route Query System

Overview

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.

Features

  • 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 Files

  • 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.

Requirements

  • Python 3.x
  • matplotlib
  • geopandas

Install dependencies with:

pip install matplotlib geopandas

Usage

GUI Route Query

python main.py

Edit Metro Data

python edit.py

Follow the prompts to add or delete lines and update station coordinates.

Data Preprocessing

Preprocessing is automatically triggered after editing data.

Data Files

  • 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).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages