Skip to content

Sameer513-code/Team-Rogue-Aurora-Mining-Monitor

Repository files navigation

Adaptive Geospatial System for Autonomous Mining Monitoring

Team Rogue | AURORA 2.0 – First-Place Solution

Python Platform License

An end-to-end Geospatial Decision Support System (DSS) for automated monitoring of open-cast mining activity and No-Go zone compliance.

This system leverages multi-sensor satellite fusion (Sentinel-2 & Sentinel-1) and adaptive statistical thresholding to convert raw earth observation data into auditable excavation metrics, violation logs, and interactive visual analytics.

Mining activity and compliance monitoring dashboard preview:

Dashboard Preview

Key Features

  • Mine-Agnostic Detection: Uses adaptive, percentile-based Change Vector Analysis (CVA) (85th percentile) instead of fixed thresholds
  • Multi-Sensor Fusion: Combines Optical (Sentinel-2) and SAR (Sentinel-1) to handle cloud cover
  • Temporal Consistency: "Holes don't disappear" logic eliminates transient noise
  • Automated Compliance: Auto-detects encroachment into Green/Yellow/Red No-Go zones
  • Decoupled Architecture: Heavy GEE processing on the backend, lightweight JSON-based dashboard on the frontend

Repository Structure

team-rogue-aurora/
│
├── pipeline.py              # Backend: Main Geospatial Analytics Engine
├── app.py                   # Backend API (Serves processed outputs)
├── main_pipeline.ipynb      # Notebook: For experimentation/visualization
│
├── frontend/                # Frontend: Client-side Dashboard
│   ├── index.html
│   ├── script1.js
│   └── style1.css
│
├── sample_inputs/           
│   ├── legal_boundary.geojson
│   └── no_go_zone.geojson
│
├── example_outputs/         # Pre-computed results
│   └── output.json
│
└── requirements.txt         # Dependencies

CRITICAL: Google Earth Engine Setup

To run the backend pipeline, you MUST provide your own Google Earth Engine (GEE) credentials. The code requires an active GEE project and authentication to access the Sentinel archives.

Option 1: Using a Service Account (Recommended for Automation)

  1. Obtain your GEE Service Account JSON key from the Google Cloud Console

  2. Place the JSON key file in the root directory (or a known path)

  3. Update pipeline.py: Open pipeline.py and modify the init_ee() function to point to your key:

    credentials = ee.ServiceAccountCredentials(
        "YOUR_SERVICE_ACCOUNT_EMAIL@your-project.iam.gserviceaccount.com",
        "path/to/your/key.json"
    )
    ee.Initialize(credentials)

Option 2: Interactive Authentication

If you do not have a service account key, modify pipeline.py to use the interactive flow:

  1. Open pipeline.py

  2. Replace the init_ee() content with:

    import ee
    try:
        ee.Initialize(project='your-google-cloud-project-id')
    except:
        ee.Authenticate()
        ee.Initialize(project='your-google-cloud-project-id')

Step 3: Configure Credentials

Rename your downloaded key file to key.json and place it in the root directory of this project:

Team-Rogue-Aurora-Mining-Monitor/
├── key.json  ← Place here
├── pipeline.py
└── ...

Update pipeline.py line 20 if your filename differs:

credentials = service_account.Credentials.from_service_account_file(
    "key.json",  # ← Update this path if needed
    scopes=["https://www.googleapis.com/auth/earthengine"]
)

SECURITY WARNING: Never commit key.json to version control. Add it to .gitignore.


Installation & Local Setup

Follow these steps to clone and run the system locally. The architecture requires running the Backend API and Frontend Server in separate terminals.

Step-by-Step Setup

1. Clone the Repository

git clone https://github.com/Sameer513-code/Team-Rogue-Aurora-Mining-Monitor.git
cd Team-Rogue-Aurora-Mining-Monitor

2. Create Virtual Environment (Recommended)

# Windows
python -m venv venv
venv\Scripts\activate

# macOS/Linux
python3 -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

Expected Dependencies:

  • fastapi - Web framework for REST API
  • uvicorn - ASGI server
  • earthengine-api - Google Earth Engine Python client
  • google-auth - Authentication libraries
  • numpy - Numerical computing
  • requests - HTTP library

4. Add Your GEE Credentials

Place your key.json file in the root directory (see GEE Setup section above).

5. Start the Backend API

Open a terminal and run:

python app.py

Expected Output:

INFO:     Started server process [12345]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000

Keep this terminal running. This hosts the API at http://127.0.0.1:8000

6. Start the Frontend Server

Open a NEW terminal in the same directory and run:

# Windows
cd frontend
python -m http.server 3000

# macOS/Linux
cd frontend
python3 -m http.server 3000

Expected Output:

Serving HTTP on :: port 3000 (http://[::]:3000/) ...

7. Access the Dashboard

Open your browser and navigate to:

http://localhost:3000

Quick Start Guide

Running Your First Analysis

  1. Upload GeoJSON Files:

    • Click "Upload Legal Mining Boundary" and select sample_inputs/legal_boundary.geojson
    • Click "Upload No-Go Zones" and select sample_inputs/no_go_zones.geojson
  2. Run Analysis:

    • Click "Run Analysis" button
    • Wait for progress bar to complete (approximately 3-5 minutes depending on area size)
  3. Explore Results:

    • KPI Cards: Current area, monthly growth, predictions
    • Timeline Slider: Scrub through historical detections
    • Chart: Visualize trends over time
    • "View Quantified Maps": See actual satellite-based change detection

Understanding the Output

The system generates:

  • output.json: Complete analysis results with timeseries data
  • outputs/mine/*.png: Monthly detection maps for legal mining area
  • outputs/no_go_zone_*/*.png: Violation detection maps for protected zones

Technical Details

Change Detection Algorithm

The pipeline implements a hybrid CVA approach:

  1. Optical Change (Sentinel-2):

    • Calculate NDVI and NBR indices
    • Compute change magnitude: √(ΔNDVI² + ΔNBR²)
    • Adaptive threshold: 85th percentile of change distribution
  2. SAR Change (Sentinel-1):

    • VV/VH polarization ratio analysis
    • Threshold: 80th percentile of backscatter change
  3. Fusion Logic:

    • Candidate pixels: (Optical_change > T_opt) OR (SAR_change > T_sar)
    • Temporal consistency: Require detection in ≥2 consecutive months
    • Cumulative masking: "Excavated pixels remain excavated"

Data Processing Parameters

Parameter Value Rationale
Satellite Sentinel-2 L2A + Sentinel-1 GRD Free, 5-10 day revisit
Cloud Cover <10% Optical quality control
Temporal Resolution Bi-monthly (Jan/Mar/May/Jul/Sep/Nov) Balance coverage vs processing
Spatial Resolution 10m (resampled) Matches S2 VNIR bands
Analysis Period 2020-2024 Sentinel-2 maturity period

Performance Benchmarks

  • Typical Processing Time: 2-4 minutes for 10 km² area
  • API Response Time: <100ms (excluding GEE compute)
  • Accuracy: ~92% detection rate (validated against manual digitization)
  • False Positive Rate: <5% (agricultural clearings, urban expansion)

Troubleshooting

Common Issues

1. ModuleNotFoundError: No module named 'ee'

Solution: Ensure virtual environment is activated and dependencies installed:

pip install -r requirements.txt

2. EEException: Invalid token

Solution: Your key.json is missing or invalid. Re-download from Google Cloud Console.

3. CORS Error in Browser Console

Solution: Ensure backend is running on http://127.0.0.1:8000 (not localhost). Update API_URL in script1.js if needed.

4. Frontend Shows "Failed to Connect"

Solution: Check that:

  • Backend is running (python app.py)
  • Terminal shows "Uvicorn running on..."
  • No firewall blocking port 8000

5. Progress Stuck at 30%

Solution:

  • Check backend terminal for errors
  • Verify GeoJSON files are valid (use geojson.io)
  • Ensure area is covered by Sentinel satellites (not polar regions)

6. No Images Generated

Solution: Modify export_png() parameters in pipeline.py:

  • Increase max parameter (line 82) to 0.5 if images are too dark
  • Check outputs/ folder permissions

License

This project is developed for academic research purposes as part of AURORA 2.0. For commercial use, please contact the authors.


Support

For issues or questions:


Acknowledgments

  • Google Earth Engine for satellite data infrastructure
  • Copernicus Programme for Sentinel missions
  • FastAPI and Leaflet.js communities
  • Chart.js for visualization library

References

@inproceedings{lorena2002cva,
  author    = {Lorena, R. B. and others},
  title     = {A Change Vector Analysis Technique to Monitor Land Use / Land Cover},
  booktitle = {International Archives of Photogrammetry, Remote Sensing and Spatial Information Sciences},
  year      = {2002}
}
@article{drusch2012sentinel2,
  author  = {Drusch, Matthias and others},
  title   = {Sentinel-2: ESA's Optical High-Resolution Mission for GMES Operational Services},
  journal = {Remote Sensing of Environment},
  year    = {2012}
}

About

Adaptive geospatial decision support system for mining compliance monitoring

Resources

Stars

Watchers

Forks

Contributors