CoolFace
Apppublic

bhuvanpatil24/rabi-ndvi-gis

sourceHugging Faceupdated 8mo agoView on Hugging Face
1likes
App README

🌾 Rabi Crop Prediction & NDVI Visualization

(GIS + Remote Sensing + Web Mapping)

A GIS-correct, production-ready web application for Rabi season crop analysis using NDVI time-series, cadastral (khasra) boundaries, and interactive web maps.

This project is designed for research, academic, and government-grade use cases, with strict adherence to GIS standards (CRS correctness, raster–vector alignment, and spatial accuracy).


πŸš€ Features

πŸ—ΊοΈ Main Prediction Page

  • β€”OpenStreetMap basemap (EPSG:3857)
  • β€”NDVI stack overlay (GeoTIFF β†’ PNG)
  • β€”Always-visible cadastral (khasra) polygons
  • β€”Optional khasra number labels (zoom-aware toggle)
  • β€”Click on map to:
  • β€”Identify khasra
  • β€”Show predicted Rabi crop
  • β€”Show actual crop (from shapefile)
  • β€”Display NDVI trend (Nov–Feb)

πŸ›°οΈ NDVI & RGB Visualization Page

  • β€”Side-by-side RGB and NDVI maps
  • β€”Month selector: Nov, Dec, Jan, Feb
  • β€”Pixel-level NDVI value extraction
  • β€”Crop / No-crop legend
  • β€”Same cadastral overlay as main page

πŸ“Š Data & GIS Correctness

  • β€”NDVI GeoTIFFs in EPSG:32643 (UTM)
  • β€”Cadastral shapefile in EPSG:4326
  • β€”Proper CRS transformations (no CRS.Simple hacks)
  • β€”Raster sampling via Rasterio
  • β€”Vector operations via GeoPandas / Shapely

🧱 Tech Stack

Backend

  • β€”FastAPI
  • β€”Rasterio (NDVI sampling)
  • β€”GeoPandas + Shapely (khasra polygons)
  • β€”PyProj (CRS transforms)
  • β€”Matplotlib (TIFF β†’ PNG, server-side)

Frontend

  • β€”Vanilla HTML / CSS / JavaScript
  • β€”Leaflet.js
  • β€”Chart.js
  • β€”OpenStreetMap tiles

Deployment

  • β€”Docker
  • β€”Hugging Face Spaces
  • β€”Python 3.9 compatible

πŸ“ Project Structure

bash
rabi-ndvi-gis/
β”‚
β”œβ”€β”€ backend/
β”‚ β”œβ”€β”€ models/
β”‚ β”œβ”€β”€ app.py # FastAPI app
β”‚ β”œβ”€β”€ model_utils.py
β”‚ β”œβ”€β”€ raster_utils.py # NDVI handling
β”‚ └── ndvi_utils.py # Khasra logic
β”‚
β”œβ”€β”€ frontend/
β”‚ β”œβ”€β”€ index.html
β”‚ β”œβ”€β”€ visualize.html
β”‚ β”œβ”€β”€ style.css
β”‚ β”œβ”€β”€ visualize.css
β”‚ β”œβ”€β”€ script.js
β”‚ └── visualize.js
β”‚
β”œβ”€β”€ data/
β”‚ β”œβ”€β”€ images/
β”‚ β”‚ └── NDVI_STACK.tif
β”‚ └── shapefiles/
β”‚   └── rabi_updated.shp
β”‚
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ .dockerignore
└── README.md

βš™οΈ Installation (Local Development)

1️⃣ Create virtual environment (Python 3.9)

bash
python -m venv venv
source venv/bin/activate   # Linux / Mac
venv\Scripts\activate # Windows

2️⃣ Install dependencies

bash
pip install -r requirements.txt

▢️ Run Locally

bash
uvicorn backend.app:app --host 0.0.0.0 --port 8000

Open in browser:

bash
http://127.0.0.1:8000

🧠 Crop Classes

The system works with 5 standardized Rabi crop classes:

  • β€”ΰ€•ΰ₯‹ΰ€ˆ ΰ€«ΰ€Όΰ€Έΰ€² ΰ€¨ΰ€Ήΰ₯€ΰ€‚ (No Crop)
  • β€”ΰ€šΰ€¨ΰ€Ύ (Gram)
  • β€”ΰ€—ΰ₯‡ΰ€Ήΰ₯‚ΰ€ (Wheat)
  • β€”ΰ€Έΰ€°ΰ€Έΰ₯‹ΰ€‚ (Mustard)
  • β€”ΰ€…ΰ€¨ΰ₯ΰ€― ΰ€«ΰ€Έΰ€² (Other Crop)

Actual crop names from the shapefile are mapped internally to these classes.


πŸ“œ License

This project is intended for educational, research, and demonstration purposes. For government or commercial deployment, ensure proper data licensing.


πŸ‘€ Author

Bhuvan Patil

GIS β€’ Remote Sensing β€’ Machine Learning β€’ Web Mapping