This repo contains the deployed interactive web application for land cover classification using random forest
# Mombasa Land Cover Classification: End-to-End Geospatial Machine Learning Project
## Project Overview
This project demonstrates an end-to-end geospatial machine learning pipeline. It takes raw, multi-spectral satellite imagery of Mombasa, Kenya, translates the spatial data into a tabular format, trains a machine learning classifier to identify distinct spectral signatures, and reconstructs the predictions into a fully interactive web map.
The model successfully categorizes every 10-meter pixel into one of four distinct land cover classes: **Water**, **Urban (Built-up)**, **Bareground** and **Vegetation**, achieving an **Overall Accuracy of 89%**.
**View the Live Interactive Map Here**
---
## Tech Stack
* **Data Sourcing & Cloud Computing:** Google Earth Engine (GEE) Python API, `geemap`
* **Data Engineering:** `pandas`, `numpy`, `rasterio`
* **Machine Learning:** `scikit-learn` (Random Forest Classifier)
* **Geospatial Visualization:** QGIS, `qgis2web` (OpenLayers/Leaflet)
---
## Methodology & Pipeline
### 1. Cloud-Native Data Sourcing
Instead of manually downloading and processing heavy satellite imagery, the Google Earth Engine Python API was utilized to programmatically access the **Sentinel-2 Surface Reflectance** dataset.
* A custom region of interest (ROI) was defined using a Mombasa boundary shapefile.
* A temporal median composite was generated for the year to programmatically mask out clouds and shadows.
* The optical and near-infrared bands (B2, B3, B4, B8) were extracted and clipped to the exact county geometry.
### 2. Feature Engineering & Sampling
* Ground truth training polygons were manually digitized over known Water, Urban, and Vegetation zones.
* The `.sampleRegions()` function was used to extract the raw light reflectance values (features) for those specific pixels.
* The extracted spatial data was converted into a standard tabular Pandas DataFrame and downsampled to ensure perfectly balanced classes before training.
### 3. …