Skip to content

Latest commit

 

History

56 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LANDROID

AI-Powered Land Intelligence Platform

Hackathon Prototype — Birdscale Technology × VIT Chennai | April 2026

Flutter FastAPI MapLibre OpenCV Firebase


Overview

Landroid is an AI-powered mobile-first platform that transforms raw drone survey data into actionable land intelligence. Built for land consultants and landowners, it provides real-time land health monitoring, plant intelligence, tree canopy analysis, and AI-driven land valuation — all on a single interactive GIS map.

The platform ingests Birdscale-provided geospatial datasets (orthomosaics, DEM, NDVI rasters, boundary GeoJSON) and enriches them with live data from 5 free open APIs to produce computed, confidence-scored AI outputs.

Key Highlights

  • 3 fully functioning AI modules with dynamic confidence scores on every output
  • Real-time tile server rendering multi-gigabyte GeoTIFF rasters as on-demand Web Mercator tiles
  • Live API integrations — ISRIC SoilGrids, OSM Overpass, OSM Nominatim, Microsoft Planetary Computer, Open-Meteo
  • Two distinct user roles — Land Consultant (Admin) and Landowner (Read-only) with access control
  • English + Tamil language support

Architecture

┌──────────────────────────────────────────────────────────────┐
│                     Flutter Mobile App                        │
│  MapLibre GL  ·  Firebase Auth  ·  Provider State Mgmt       │
│  Glassmorphic UI  ·  Multi-language (EN / Tamil)             │
└──────────────────────┬───────────────────────────────────────┘
                       │ HTTP / REST
┌──────────────────────▼───────────────────────────────────────┐
│                    FastAPI Backend                            │
│                                                              │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐       │
│  │ Land Health  │  │ Plant Health │  │ Tree & Canopy│       │
│  │ Dashboard    │  │ Zone Map     │  │ Count        │       │
│  │ (FR-18→24)  │  │ (FR-25→28)  │  │ (FR-29→33)  │       │
│  └──────┬───────┘  └──────┬───────┘  └──────┬───────┘       │
│         │                 │                 │               │
│  ┌──────▼─────────────────▼─────────────────▼───────┐       │
│  │              Tile Server (z/x/y.png)              │       │
│  │  Windowed reads · Vectorised colormaps · Cache    │       │
│  └──────────────────────┬────────────────────────────┘       │
│                         │                                    │
│  ┌──────────────┐  ┌────▼─────────┐  ┌──────────────┐       │
│  │ Land         │  │ Geofencing   │  │ Document     │       │
│  │ Valuation    │  │ & Alerts     │  │ Vault        │       │
│  │ (FR-34→38)  │  │ (FR-39→43)  │  │ (FR-44→47)  │       │
│  └──────────────┘  └──────────────┘  └──────────────┘       │
└──────────────────────────────────────────────────────────────┘
         │                    │                │
    ┌────▼────┐         ┌────▼────┐      ┌────▼────┐
    │ SoilGrids│        │ OSM     │      │Planetary│
    │ (ISRIC)  │        │Overpass │      │Computer │
    │          │        │Nominatim│      │Open-Meteo│
    └──────────┘        └─────────┘      └──────────┘

AI Modules

Module 1: Land Health Dashboard (FR-18 → FR-24)

Aggregates four environmental signals into a single composite Land Health Score (0–100).

Signal Weight Data Source What It Measures
NDVI Trend 40% Birdscale NDVI raster + Sentinel-2 Vegetation health & historical trend
Rainfall Adequacy 30% Open-Meteo Historical API Annual/monthly precipitation vs. regional normal
Soil Quality 20% ISRIC SoilGrids REST API pH, organic carbon, texture classification
Temperature Suitability 10% Open-Meteo Historical API Monthly trend, heat stress event count

Score Mapping: Healthy (75–100) · Moderate (50–74) · At Risk (below 50)

Each signal card displays: current value, trend indicator, and a per-signal confidence score.

Module 2: Plant Health Zone Map (FR-25 → FR-28)

Classifies the NDVI raster into four health zones rendered as a colour-coded overlay:

Zone NDVI Range Colour
Bare/Stressed < 0.2 Brown
Sparse 0.2 – 0.4 Amber
Healthy 0.4 – 0.6 Light Green
Dense > 0.6 Dark Green

Computes percentage area in each zone with dynamic confidence based on valid pixel ratio and NDVI spread.

Module 3: Tree & Canopy Count (FR-29 → FR-33)

OpenCV watershed-based pipeline for individual tree canopy detection:

Orthomosaic → Excess Green Index (2G-R-B) → Gaussian Blur → Otsu Threshold
→ Morphological Opening → Distance Transform → Watershed Segmentation
→ Contour Detection → Canopy Count + Stress Flagging

Outputs:

  • Total canopy count and density per acre
  • GeoJSON FeatureCollection of canopy centroids overlaid on the orthomosaic
  • Stressed canopy detection (area < 50% of parcel median)
  • Cross-date comparison: new/missing canopies flagged with visual markers
  • Confidence score derived from GSD (ground sampling distance) and detection clarity

Module 4: Land Valuation (FR-34 → FR-38)

Estimates land value (Rs. per acre) using five weighted signals:

Signal Weight Source
Land Health Score 30% Module 1 output
OSM Proximity (highway, town, water) 25% OSM Overpass API
Soil Quality 20% ISRIC SoilGrids API
Rainfall Adequacy 15% Open-Meteo / CHIRPS
Night Light Index 10% Planetary Computer VIIRS

Output: Low / Mid / High value band with Rs./acre range, confidence score (%), and top 3 driving factors listed with positive/negative impact.

All valuation outputs are labelled as estimated intelligence ranges, not legal or government guideline valuations.


Open APIs Used

All APIs are free with no credit card required.

API What It Provides Signup Used By
ISRIC SoilGrids REST API Soil type, pH, organic carbon, texture by coordinates None — immediate Health Dashboard, Valuation
OSM Overpass API Highway, water body, town proximity by bounding box None — immediate Valuation (proximity signals)
OSM Nominatim Reverse geocoding — town, taluk, district, state None — immediate Valuation (location context)
Microsoft Planetary Computer VIIRS night-light radiance, Sentinel-2 NDVI time series Free email signup Valuation, NDVI history
Open-Meteo Historical Weather Monthly rainfall (CHIRPS-equivalent), temperature (ERA5-equivalent) None — immediate Health Dashboard (climate signals)

API Flow

When a parcel boundary is confirmed, the backend derives the centroid and bounding box and fires all API calls in parallel using asyncio.gather():

Boundary GeoJSON → Centroid + BBox
    ├── ISRIC SoilGrids    (centroid)     → pH, organic carbon, texture
    ├── OSM Overpass        (bbox + 5km)  → highway/water/town proximity
    ├── OSM Nominatim       (centroid)    → town, district, state
    ├── Planetary Computer  (centroid)    → VIIRS night-light radiance
    └── Open-Meteo Archive  (centroid)    → rainfall + temperature history

Tech Stack

Layer Technology
Mobile Framework Flutter (Dart)
Map Rendering MapLibre GL (maplibre_gl package)
Backend Framework FastAPI (Python) with Uvicorn
Geospatial Processing Rasterio, PyProj, Shapely
Computer Vision OpenCV (watershed segmentation)
ML / Data NumPy, scikit-learn (TrendPredictor)
Authentication Firebase Auth (OTP + Google Sign-In)
State Management Provider
Tile Serving Custom real-time tile renderer (windowed reads, vectorised colormaps, in-memory cache)

Repository Structure

landroid/
├── backend/                      # FastAPI Backend
│   ├── main.py                   # App entrypoint, router registration, CORS
│   ├── routers/                  # API endpoint handlers
│   │   ├── health_dashboard.py   # Land Health Dashboard (Module 1)
│   │   ├── plant_zones.py        # Plant Health Zone Map (Module 2)
│   │   ├── canopy_count.py       # Tree & Canopy Count (Module 3)
│   │   ├── valuation.py          # Land Valuation (Module 4)
│   │   ├── tiles.py              # Real-time tile server (NDVI, DEM, Zones, Terrain)
│   │   ├── boundary.py           # Boundary GeoJSON + centroid/bbox
│   │   ├── documents.py          # Document Vault CRUD
│   │   ├── geofencing.py         # Geofence rules and alerts
│   │   ├── time_series.py        # NDVI time series data
│   │   └── trends.py             # ML trend predictions
│   ├── services/                 # Core business logic & API clients
│   │   ├── soilgrids.py          # ISRIC SoilGrids REST API client
│   │   ├── osm.py                # OSM Overpass + Nominatim client
│   │   ├── planetary.py          # Planetary Computer VIIRS + Open-Meteo climate
│   │   ├── canopy.py             # OpenCV watershed canopy detection pipeline
│   │   ├── ndvi_service.py       # Sentinel-2 NDVI time series fetcher
│   │   ├── scoring.py            # Land valuation weighted formula
│   │   ├── parcel_registry.py    # Parcel data management
│   │   └── time_series.py        # Time series processing
│   ├── ml/
│   │   └── trend_predictor.py    # TrendPredictor ML model
│   ├── models/
│   │   └── schemas.py            # Pydantic request/response schemas
│   ├── utils/
│   │   ├── confidence.py         # Confidence score calculations for all modules
│   │   ├── geo.py                # Haversine distance and geo utilities
│   │   └── raster.py             # GeoTIFF download, read, and cleanup
│   └── tests/                    # Pytest test suites
├── mobile/                       # Flutter Mobile App
│   └── lib/
│       ├── main.dart             # App entry point
│       ├── core/                 # Constants, theme, localizations (EN + Tamil)
│       ├── models/               # Dart data models (canopy, health, valuation, zones)
│       ├── providers/            # State management (language provider)
│       ├── screens/              # UI screens (map, dashboard, auth, insights, etc.)
│       ├── services/             # API service + Auth service
│       └── widgets/              # Reusable UI (GlassCard, HealthRing, MetricCard)
├── data/                         # (Gitignored) Birdscale raster data & GeoJSONs
├── docs/                         # Architecture, API contracts, ML overview
├── .env.example                  # Environment variable template
├── .gitignore                    # Ignores .env, data/*, node_modules
└── requirements.txt              # Python dependencies

Getting Started

Prerequisites

  • Python 3.10+
  • Flutter SDK 3.11+
  • Android Studio / Emulator (API 29+)
  • Git

1. Clone the Repository

git clone <repository-url>
cd landroid

2. Backend Setup

cd backend

# Create and activate virtual environment
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Configure environment
cp ../.env.example .env
# Edit .env — fill in PLANETARY_COMPUTER_SUBSCRIPTION_KEY if available

# Start the server
uvicorn main:app --host 0.0.0.0 --port 8000 --reload

Important — Warm up tile cache for instant map loading:

GET http://localhost:8000/api/v1/tiles/warmup

Interactive API docs: http://localhost:8000/docs

3. Place Birdscale Data

Place the provided geospatial files in the data/ directory (these are gitignored and never committed):

data/
├── Orthomosaic.tif               # Drone orthomosaic (GeoTIFF)
├── ndvi.tif                      # NDVI raster (GeoTIFF)
├── Digital Elevation model.tif   # DEM elevation raster (GeoTIFF)
└── boundary_wgs84.geojson        # Parcel boundary (GeoJSON)

4. Mobile Setup

cd mobile

# Install Flutter dependencies
flutter pub get

# Update API base URL in lib/core/app_constants.dart
# Set it to your machine's local IP (e.g., http://192.168.x.x:8000)

# Run on device or emulator
flutter run

API Endpoints

All endpoints are prefixed with /api/v1.

Method Endpoint Description
POST /health-dashboard Land Health Dashboard — composite score + 4 signals
POST /plant-zones Plant Health Zone classification (4 NDVI categories)
POST /canopy-count Tree & canopy detection with GeoJSON overlay
POST /valuation Land valuation estimate with factor breakdown
GET /tiles/ndvi/{z}/{x}/{y}.png NDVI colour-ramp tile layer
GET /tiles/dem/{z}/{x}/{y}.png DEM elevation colour-ramp tile layer
GET /tiles/zones/{z}/{x}/{y}.png Plant health zone colour-coded tile layer
GET /tiles/terrain/{z}/{x}/{y}.png Mapbox Terrain-RGB encoded tiles
GET /tiles/warmup Pre-render all parcel tiles for instant loading
POST /boundary Parcel boundary GeoJSON, centroid, bbox, area
POST /documents/upload Upload document to vault (Land Consultant only)
GET /documents/{parcel_id} List documents for a parcel
POST /geofencing/rules Create geofence rule
GET /geofencing/{parcel_id} List geofence rules and alerts
POST /time-series NDVI time series data
POST /trends ML trend predictions
GET /health Server health check

Confidence Scoring

Every AI output includes a confidence score (0–100%) that reflects data quality, not just a static label.

How Confidence Is Computed

Canopy Count: Weighted combination of image resolution (GSD), canopy count plausibility, and null pixel ratio.

Land Health Dashboard: Based on NDVI raster valid pixel coverage, and whether soil (SoilGrids), rainfall (Open-Meteo), and temperature data came from live APIs vs. fallbacks.

Land Valuation: Starts at 60%, then adjusts based on whether OSM proximity signals were found (+15/-10), VIIRS night-light is real (+10/-8), SoilGrids responded (+8/-5), and rainfall data is live (+7/-5).

Plant Zones: Derived from NDVI valid pixel ratio and spectral spread of values.


User Roles

Feature Land Consultant (Admin) Landowner (User)
Create / edit parcels Yes No
Upload drone rasters Yes No
Draw boundary polygon Yes No
Assign parcel to Landowner Yes No
Land Health Dashboard All parcels Own parcels only
Plant Health Zone Map All parcels Own parcels only
Tree & Canopy Count All parcels Own parcels only
Land Valuation All parcels Own parcels only
Document Vault — upload Yes No
Document Vault — view All parcels Own parcels only
Geofencing alerts All parcels Own parcels only

Testing

cd backend
pytest tests/ -v

Test suites cover:

  • Canopy detection pipeline
  • Health dashboard scoring
  • Plant zone classification
  • Land valuation formula
  • API routing and error handling

Security

  • Zero credentials in source code — all API keys and tokens stored in .env (gitignored)
  • .gitignore excludes .env, .venv, data/*, __pycache__/
  • All Birdscale-provided datasets are gitignored and fetched at runtime
  • Bearer token authentication on API requests
  • Firebase Auth with Android Keystore for secure token storage
  • No permanent public document sharing links — time-limited only (48 hours)

Environment Variables

# .env.example
PLANETARY_COMPUTER_SUBSCRIPTION_KEY=   # Optional — public collections work without key
APP_ENV=development                     # development | production
LOG_LEVEL=INFO

Demo Narrative

"The Land Consultant created this parcel and assigned it to the Landowner. The Land Health Score is 58 — Moderate. NDVI has dropped 12% over 2 years and rainfall is 9% below normal. The NDVI zone map shows 34% of the parcel is in the stressed zone. We detected 386 trees; 11 are flagged as potentially stressed. Estimated value: Rs. 2.4L to Rs. 3.1L per acre."

All outputs are dynamically computed from real data — changing the input parcel changes every result.


Built for the Birdscale Technology × VIT Chennai Hackathon — April 2026

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages