Skip to content

Interactive ski resort map with 3D terrain visualization, real-time weather monitoring and AI-powered skier counting. Leaflet.js + Three.js + PHP + MySQL.

Notifications You must be signed in to change notification settings

MetrPikeska/VYGEO

Repository files navigation

VYGEO OPALENA: Interactive GIS for Ski Resort Management

Overview

VYGEO OPALENA is an interactive web-based GIS application designed for the management, monitoring, and visualization of geographical data within the Opálená ski resort in the Beskydy mountains. This project integrates web technologies, geoinformatics, and IoT to enable real-time operational data management and analysis.

Key objectives include:

  • Centralized area management within a unified map environment.
  • Visualization of technological and natural elements (snowmaking, lifts, services).
  • Processing of weather and elevation data.
  • AI-powered sheep detection on slopes using the YOLOv8 model.
  • Provision of analytical tools for operational management and prediction.

Features

Core Functionality

  • Interactive Map: Dynamic mapping interface with custom tile layers.
  • Object Management: Comprehensive CRUD (Create, Read, Update, Delete) operations for geographical features (points, lines, polygons) with GeoJSON support.
  • Elevation Data Integration: Automatic retrieval and display of elevation data for map objects.
  • Real-time Weather: Display of current temperature, weather conditions, and 3-day forecasts from OpenWeatherMap.
  • GPS Localization: User location tracking for enhanced navigation and data collection.
  • Wet-bulb Temperature Calculator: Specialized tool for optimizing snowmaking conditions.
  • Layer Management: Toggle visibility of various map layers for customized views.
  • Photo Documentation: Upload and display photos linked to specific map features.

Advanced Features

  • AI Sheep Detection: Real-time monitoring and visualization of sheep count on ski lifts for safety using YOLOv8.
  • Authentication & Authorization: Secure login system with role-based access control (admin/test) for managing data and exports.
  • Data Visualization: Integration of Chart.js for displaying statistics and graphs.

Technology Stack

  • Frontend: HTML5, CSS3, JavaScript (ES6+), Leaflet.js (mapping), Chart.js (data visualization).
  • Backend: PHP 7.4+ with a RESTful API for robust data handling and processing.
  • Database: MySQL 5.7+ as the primary data store, with SQLite fallback for local/offline operations.
  • AI/IoT Integration: Python scripts for AI inference (YOLOv8) and potential future IoT sensor integration.
  • External APIs: OpenWeatherMap, Mapy.cz, OpenElevation, Teal.cz (webcam stream).

Project Structure

VYGEO/
├── api/                    # Backend API endpoints (PHP, SQL)
├── assets/                 # Static assets (icons, images, 3D models)
├── css/                    # Stylesheets
├── data/                   # Data files (e.g., sheep.json, snow_calc)
├── js/                     # Frontend JavaScript modules
├── scripts/                # Python scripts for AI and data processing
├── tiles/                  # Custom map tile data
├── wet-bulb-calculator/    # Wet-bulb temperature calculator module
├── index.html              # Main application entry point
├── README.md               # Project documentation
└── ... (other root files)

Getting Started

Prerequisites

  • Web server (Apache, Nginx, or PHP's built-in server)
  • PHP 7.4+ (with mysqli and pdo_mysql or pdo_sqlite extensions enabled)
  • MySQL 5.7+ or SQLite
  • Composer (optional, for PHP dependencies if any)
  • Node.js & npm (optional, if frontend build tools are used)
  • Git

Installation

  1. Clone the repository:

    git clone https://github.com/MetrPikeska/VYGEO.git
    cd VYGEO
  2. Database Setup (MySQL example): Create a MySQL database and user. Then, execute the following SQL to create the necessary tables:

    CREATE DATABASE vygeo;
    USE vygeo;
    
    CREATE TABLE map_features (
        id INT AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(255) NOT NULL,
        type VARCHAR(50) NOT NULL,
        geojson TEXT NOT NULL,
        elevation_data TEXT NULL,
        color VARCHAR(7) NULL,
        created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
    );
    
    CREATE TABLE feature_photos (
        id INT AUTO_INCREMENT PRIMARY KEY,
        feature_id INT NOT NULL,
        photo_data LONGTEXT NOT NULL,
        created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
        FOREIGN KEY (feature_id) REFERENCES map_features(id) ON DELETE CASCADE
    );
    
    CREATE TABLE sheep_log (
        id INT AUTO_INCREMENT PRIMARY KEY,
        timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
        count INT DEFAULT 0,
        confidence FLOAT NULL
    );
  3. Environment Configuration: Create a .env file in the project root based on config.example.js (for JS) and api/hosting_config.php (for PHP backend). Example .env content:

    DB_HOST=localhost
    DB_USER=your_username
    DB_PASS=your_password
    DB_NAME=vygeo
    MAPY_CZ_API_KEY=your_mapy_cz_api_key
    OPENWEATHER_API_KEY=your_openweather_api_key
  4. Download YOLO Model (Optional - for Sheep Detection): If you intend to use the AI sheep detection feature, download a YOLOv8 model (e.g., yolov8n.pt) and place it in the project directory:

    wget https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt
    # Or download manually from: https://github.com/ultralytics/ultralytics

Running the Application

Using PHP's Built-in Server (for development):

  1. Open your terminal in the VYGEO project root directory.
  2. Run the command:
    php -S localhost:8000
  3. Access the application in your web browser at http://localhost:8000.

Using Apache/Nginx (for production or local setup like WAMP/XAMPP):

  1. Ensure your web server is configured to serve the VYGEO directory.
  2. Make sure PHP is correctly installed and configured to process .php files in your web server's settings (e.g., httpd.conf for Apache, or virtual host settings).
  3. Access the application via your configured domain or http://localhost/VYGEO/.

Usage

  1. Open the application in your web browser.
  2. Login as admin (username: admin, password: opalena) for full functionality.
  3. Interact with the map: Create, edit, or delete geographical objects.
  4. View weather data and use the wet-bulb calculator.
  5. Monitor sheep count (if AI detection is set up).
  6. Upload photos to map features.

API Endpoints

  • GET /api/features.php?action=list: Retrieve all geographical features.
  • POST /api/features.php: Create a new geographical feature.
  • PUT /api/features.php: Update an existing geographical feature.
  • DELETE /api/features.php?id=X: Delete a geographical feature by ID.
  • POST /api/auth.php: Handle user authentication (login/logout).
  • GET /api/map_proxy.php: Proxy for map tiles (hides API key).
  • GET /api/weather_proxy.php: Proxy for weather data (hides API key).
  • POST /api/update.php: Update sheep count data.
  • POST /api/upload_photo.php: Upload photos linked to features.

Security Considerations

  • API Key Protection: External API keys are handled via proxy servers.
  • CORS Restrictions: Cross-Origin Resource Sharing is configured to allowed domains.
  • Input Validation: Measures are in place to prevent SQL injection and other vulnerabilities.
  • File Upload Security: Validation for file type, size, and dimensions for uploaded photos.
  • Authentication & Authorization: Secure login system with role-based access control.
  • HTTPS Requirement: GPS localization, camera access, and photo uploads require a secure HTTPS connection.

Contributing

We welcome contributions to the VYGEO OPALENA project! To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature-name).
  3. Make your changes and ensure they adhere to the project's coding standards.
  4. Commit your changes (git commit -m 'Add new feature').
  5. Push to the branch (git push origin feature/your-feature-name).
  6. Open a Pull Request.

License

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

Contact

For questions, issues, or collaborations, please contact:

Petr Mikeska petrmikeska.cz


VYGEO OPALENA v1.0 - Monitoring and Management for Opálená Ski Resort

About

Interactive ski resort map with 3D terrain visualization, real-time weather monitoring and AI-powered skier counting. Leaflet.js + Three.js + PHP + MySQL.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published