Skip to content

suchithgali/CatTracksWebsite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CatTracks - Intelligent Transit Route Optimization System

License: MIT C++ Python

CatTracks is an intelligent transit route optimization system designed for Merced County public transportation. The system combines Geographic Information Systems (GIS) data processing with advanced graph algorithms to provide optimal route planning for bus transit users.

Features

  • Smart Route Planning: Find optimal paths combining walking and bus transportation
  • Real-time Address Lookup: Geocoding using Google Maps API with local database fallback
  • Multi-modal Transportation: Seamlessly integrate walking and bus routes
  • GIS Data Integration: Process geographical data from GeoPackage files
  • Distance Optimization: Calculate shortest paths using Dijkstra's algorithm
  • Interactive Route Generation: Step-by-step directions with distance and time estimates

Table of Contents

πŸ› οΈ Installation

Prerequisites

  • C++ Compiler: GCC 9+ or Clang 10+ with C++17 support
  • Python: 3.8 or higher
  • CMake: 3.15 or higher
  • vcpkg: For C++ package management
  • Git: For version control

Required C++ Dependencies

# Install vcpkg dependencies
vcpkg install cpr nlohmann-json

Required Python Dependencies

pip install -r requirements.txt

Required Python packages:

  • geopandas
  • pandas
  • numpy
  • requests
  • fiona

Build Instructions

  1. Clone the repository:

    git clone https://github.com/suchithgali/CatTracksWebsite.git
    cd CatTracks
  2. Configure CMake:

    mkdir build
    cd build
    cmake -DCMAKE_TOOLCHAIN_FILE=[path-to-vcpkg]/scripts/buildsystems/vcpkg.cmake ..
  3. Build the project:

    make -j$(nproc)

Quick Start

πŸš€ Quick Start

1. Set Up API Keys

# Use the automated setup script
./scripts/setup_api_keys.sh

# OR set manually
export GOOGLE_MAPS_API_KEY="your_google_maps_api_key"
export OPENROUTESERVICE_API_KEY="your_openrouteservice_api_key"

2. Prepare GIS Data

cd src/python
python address_lookup.py  # Generate address database

3. Find Route

python find_nearest.py
# Enter starting address: MERCED MALL TARGET
# Enter destination address: UC MERCED

4. Generate Optimal Path

cd ../../build
./c1_graph_builder

5. View Results

cat ../output/optimal_route_path.txt

πŸ“ Project Structure

CatTracks/
β”œβ”€β”€ README.md                 # Project documentation
β”œβ”€β”€ LICENSE                   # License file
β”œβ”€β”€ CMakeLists.txt           # CMake configuration
β”œβ”€β”€ .gitignore               # Git ignore rules
β”œβ”€β”€ requirements.txt         # Python dependencies
β”‚
β”œβ”€β”€ src/                     # Source code
β”‚   β”œβ”€β”€ cpp/                 # C++ implementation
β”‚   β”‚   β”œβ”€β”€ c1_graph_builder.cpp
β”‚   β”‚   β”œβ”€β”€ graph_builder.cpp
β”‚   β”‚   β”œβ”€β”€ multi_stop_graph_builder.cpp
β”‚   β”‚   β”œβ”€β”€ detailed_route_builder.cpp
β”‚   β”‚   └── database_test.cpp
β”‚   └── python/              # Python scripts
β”‚       β”œβ”€β”€ find_nearest.py
β”‚       β”œβ”€β”€ address_lookup.py
β”‚       β”œβ”€β”€ distance_converter.py
β”‚       β”œβ”€β”€ intersection_lookup.py
β”‚       β”œβ”€β”€ layer_lookup.py
β”‚       └── remove_duplicates.py
β”‚
β”œβ”€β”€ include/                 # Header files
β”‚   β”œβ”€β”€ Graph.h
β”‚   β”œβ”€β”€ Node.h
β”‚   β”œβ”€β”€ Edge.h
β”‚   β”œβ”€β”€ ArrayList.h
β”‚   β”œβ”€β”€ LinkedList.h
β”‚   └── json.hpp
β”‚
β”œβ”€β”€ data/                    # Data files
β”‚   β”œβ”€β”€ all_addresses.csv
β”‚   β”œβ”€β”€ all_intersections.csv
β”‚   β”œβ”€β”€ all_stops.csv
β”‚   β”œβ”€β”€ road_lengths_miles.csv
β”‚   β”œβ”€β”€ route_info.json
β”‚   └── optimal_route_results.json
β”‚
β”œβ”€β”€ output/                  # Generated output files
β”‚   └── optimal_route_path.txt
β”‚
β”œβ”€β”€ geopkg/                  # GeoPackage files
β”‚   β”œβ”€β”€ merced_county_site_address_pointsshp.gpkg
β”‚   β”œβ”€β”€ merced_intersections.gpkg
β”‚   └── merced_road_centerlines.gpkg
β”‚
β”œβ”€β”€ build/                   # Build artifacts (auto-generated)
β”œβ”€β”€ cache/                   # API response cache
β”œβ”€β”€ docs/                    # Documentation
β”œβ”€β”€ examples/                # Usage examples
β”œβ”€β”€ scripts/                 # Utility scripts
└── vcpkg/                  # Package manager

Usage Examples

Example 1: Campus Route Planning

# Run the route finder
python src/python/find_nearest.py

# Input:
# Starting address: 781 IRMA DRIVE
# Destination: UC MERCED

# Output: Generates route_info.json with optimal path data

Example 2: Multi-stop Route Optimization

# Build and run multi-stop planner
./build/multi_stop_graph_builder

# Processes multiple destinations for efficient routing

Example 3: Custom GIS Data Processing

# Convert road lengths to miles
python src/python/distance_converter.py

# Lookup specific intersections
python src/python/intersection_lookup.py

Configuration

API Keys

API Keys

Set your API keys as environment variables:

# Set Google Maps API key
export GOOGLE_MAPS_API_KEY="your_api_key_here"

# Set OpenRouteService API key
export OPENROUTESERVICE_API_KEY="your_api_key_here"

For persistent setup, add these to your shell configuration file (~/.bashrc, ~/.zshrc, etc.):

echo 'export GOOGLE_MAPS_API_KEY="your_api_key_here"' >> ~/.zshrc
echo 'export OPENROUTESERVICE_API_KEY="your_api_key_here"' >> ~/.zshrc
source ~/.zshrc

Data Sources

Configure GIS data sources in the respective Python scripts:

  • Address data: geopkg/merced_county_site_address_pointsshp.gpkg
  • Intersection data: geopkg/merced_intersections.gpkg
  • Road centerlines: geopkg/merced_road_centerlines.gpkg

Testing

Run the database test suite:

./build/database_test

Validate walking logic:

python src/python/test_walking_logic.py

Performance

  • Route Calculation: < 500ms for typical routes
  • Address Lookup: < 100ms with local database
  • Memory Usage: ~50MB for full Merced County dataset
  • Accuracy: Β±10 meters for GPS coordinates

Contributing

I welcome contributions! Please see my Contributing Guidelines for details.

Development Workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Code Style

  • C++: Follow Google C++ Style Guide
  • Python: Follow PEP 8
  • Documentation: Use clear, concise comments

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Merced County for providing GIS data
  • Google Maps API for geocoding services
  • UC Merced for transit route information
  • Open source community for supporting libraries

πŸ“§ Contact

πŸ—ΊοΈ Roadmap

  • trip planning integration for the remaining bus routes
  • Real-time bus tracking integration
  • web ui application development
  • Machine learning for traffic prediction
  • Multi-language support
  • Accessibility features for disabled users
  • Integration with other transit systems

CatTracks - Making public transportation smarter, one route at a time.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published