v1.0April 2025Production

Sol — Product Requirements Document

An AI-powered urban heat vulnerability mapping platform for California, combining remote sensing data, machine learning, and real-time climate information.

Overview

Sol identifies neighborhoods across California that are most at risk from extreme heat events. It combines three satellite-derived features — NDVI (vegetation), LST (land surface temperature), and building footprint density — into a Random Forest model that outputs a normalized heat-vulnerability score for each 100 m grid cell statewide.

An interactive 3D DeckGL heatmap lets users explore vulnerability scores, overlay real-time weather and AQI data, simulate tree planting, review climate projections, and export priority zones for municipal use.

0.91
R² Score
0.09
MAE
100m
Grid Resolution
~50k
Data Points

Problem Statement

  • 489,000 annual heat deaths globally — rising each year due to climate change and urban heat island expansion.
  • Uneven distribution of green space — lower-income neighborhoods in California lack tree canopy, amplifying heat risk.
  • No unified decision tool — city planners lack a single interface that combines vulnerability scoring, live weather, and tree planting simulation.
  • Data siloed across agencies — NDVI, LST, SVI, and AQI data exist but are fragmented and inaccessible to non-experts.

Solution

Sol is a full-stack Next.js application that:

  1. 1Rasterizes Google Earth Engine exports (NDVI, LST, building footprints) into a uniform 100 m feature grid
  2. 2Trains a Random Forest model on those features, with weights optimized post-hoc by Gemini 2.5 Flash
  3. 3Serves the resulting vulnerability scores via a GeoJSON API to a DeckGL 3D heatmap
  4. 4Augments the map with live weather (Open-Meteo), AQI (EPA AirNow), Social Vulnerability Index, heat alerts, climate forecasts (2025–2035), and tree planting simulation
  5. 5Exports prioritized zones as CSV or GeoJSON for municipal use

Implemented Features

Implemented
3D DeckGL Heatmap
Pitch + bearing interactive map with HeatmapLayer showing vulnerability scores across California. Scatterplot overlay for point-level inspection.
Implemented
Live Weather Widget
Real-time temperature, humidity, wind, precipitation fetched from Open-Meteo for any selected city.
Implemented
Heat Alerts Panel
NWS-style severity-coded alerts with color-coded banners. Powered by AI-generated advisory content via Anthropic Claude API.
Implemented
Climate Projections Slider
Simulates temperature-driven vulnerability shift from 2025–2035. Adjustable offset applied to the entire heatmap dataset.
Implemented
Historical Heat Panel
Trend chart for heat-related metrics over past years using Recharts AreaChart.
Implemented
AQI Overlay
EPA AirNow PM2.5 station data rendered as a scatterplot layer with color-coded severity.
Implemented
Social Vulnerability Index (SVI)
CDC SVI data overlaid as a secondary scatterplot to show compounding vulnerabilities.
Implemented
Tree Planting Simulator
Draw zones on the map and simulate NDVI improvement. Recalculates vulnerability scores dynamically.
Implemented
Export Tools
One-click CSV and GeoJSON export of filtered priority zones for city planning workflows.
Implemented
Forecast Panel
7-day weather forecast chart for selected California city using Open-Meteo.
Implemented
AI Explain
Claude-powered natural-language explanation of any clicked vulnerability point.
Partial
Mapbox Satellite Toggle
Map/Satellite layer toggle present; full satellite tiles require Mapbox token.
Planned
User Accounts & Saved Zones
Allow planners to save and annotate zones across sessions.
Planned
Multi-city Expansion
Extend model coverage to other US states beyond California.

Architecture

Sol is a monolithic Next.js 15 application with App Router. All data processing, API routes, and frontend live in a single repo.


┌─────────────────────────────────────────────────────┐
│                    Browser                          │
│  ┌──────────────┐   ┌──────────────────────────┐   │
│  │ Landing Page │   │   3D Visualization        │   │
│  │  /           │   │   /visualize              │   │
│  │  /about      │   │                           │   │
│  │  /prd        │   │  DeckGL HeatmapLayer      │   │
│  └──────────────┘   │  Mapbox GL basemap        │   │
│                     │  Panels (Weather/SVI/AQI) │   │
│                     └──────────────────────────┘   │
└───────────────┬─────────────────┬───────────────────┘
                │ fetch           │ fetch
        ┌───────▼───────┐  ┌──────▼──────────┐
        │  Next.js API   │  │  External APIs  │
        │  Routes        │  │                 │
        │  /api/ndvi     │  │  Open-Meteo     │
        │  /api/weather  │  │  EPA AirNow     │
        │  /api/alerts   │  │  CDC SVI        │
        │  /api/aqi      │  │  Anthropic      │
        │  /api/forecast │  │  Google Gemini  │
        │  /api/svi      │  └─────────────────┘
        │  /api/explain  │
        │  /api/historical│
        └───────┬────────┘
                │
        ┌───────▼────────┐
        │  Static Assets  │
        │  GeoJSON files  │
        │  (public/)      │
        │  vulnerability_ │
        │  points.geojson │
        │  tree_priority. │
        │  geojson        │
        └─────────────────┘
Framework
Next.js 15 (App Router)
Rendering
Client-side ('use client')
Map Engine
DeckGL + react-map-gl
Styling
Tailwind CSS v4
Charts
Recharts
Animations
Framer Motion + MagicUI

Data Pipeline

The ML model and vulnerability scores are pre-computed offline. The pipeline runs in Python and produces GeoJSON files that are served as static assets.


Google Earth Engine
  ├─ Export NDVI raster  (Landsat 8/9, California bbox)
  └─ Export LST raster   (Band 10 thermal, 30m → 100m resampled)

OpenStreetMap / Microsoft Building Footprints
  └─ Rasterize building footprints → building density per 100m cell

generate_real_data.py
  ├─ Merge NDVI + LST + building density into feature matrix X
  ├─ Normalize all features to [0, 1]
  └─ Output: samples.csv

model/train.py  (Random Forest)
  ├─ Train on samples.csv (heat score = composite label)
  ├─ Evaluate: R²=0.87, MAE=0.13
  └─ Output: model.pkl + vulnerability_points.geojson

tuneWeightsGemini.js  (post-hoc weight tuning)
  ├─ Prompt: Gemini 2.5 Flash with feature importance context
  ├─ Response: {"w1": 0.6, "w2": 0.2, "w3": 0.2}
  └─ Re-score: R²=0.91, MAE=0.09

compute_tree_priority_ca.py
  └─ Output: tree_priority.geojson  (top-N zones for planting)

API Reference

GET
/api/ndvi

Returns vulnerability_points.geojson — pre-computed vulnerability scores with NDVI, building density, and LST attributes.

GET
/api/weather?city=Los+Angeles

Proxies Open-Meteo current weather for the given city. Returns temperature, humidity, wind, precipitation.

GET
/api/forecast?city=Los+Angeles

7-day hourly forecast from Open-Meteo. Used by ForecastPanel chart.

GET
/api/alerts?city=Los+Angeles

AI-generated heat alert advisory for the city via Anthropic Claude API.

GET
/api/aqi?lat=34&lon=-118

EPA AirNow PM2.5 stations within ~100 km of the given coordinates.

GET
/api/svi

Returns CDC Social Vulnerability Index points filtered to California.

GET
/api/historical

Returns historical heat-related event data for trend charts.

POST
/api/explain

Body: { ndvi, lst, buildingDensity, vulnerability }. Returns Claude-generated natural-language explanation of the point's risk factors.

ML Model

Random Forest
Algorithm
0.87
Initial R²
0.91
Tuned R²
0.09
MAE (tuned)

Feature weights after Gemini tuning:

{
  "w1": 0.6,   // Land Surface Temperature (LST) — dominant predictor
  "w2": 0.2,   // NDVI (vegetation) — inverse relationship with heat
  "w3": 0.2    // Building Density — proxy for impervious surface
}

Heat Score = w1 * normalized_LST
           + (1 - NDVI) * w2
           + w3 * normalized_building_density

Weight Tuning Workflow

After initial training, tuneWeightsGemini.js sends model performance metrics and feature importances to Gemini 2.5 Flash with a structured prompt. Gemini returns a JSON object with optimized weights. The model is re-scored in-process, raising R² from 0.87 → 0.91 and reducing MAE from 0.13 → 0.09.

Roadmap

v1.1
  • User accounts + saved zones (Supabase)
  • Share zone via URL (encoded state)
  • PWA / mobile layout for Visualizer
v1.2
  • Expand coverage to all US states
  • Temporal animation (year-over-year change)
  • Integrate FEMA flood + wildfire risk layers
v2.0
  • Real-time NDVI / LST via Sentinel Hub streaming
  • Municipal dashboard with KPI tracking
  • Public API for third-party integrations