File size: 1,698 Bytes
1027689
25b1296
 
 
 
1027689
 
25b1296
1027689
 
25b1296
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
title: AGROW Heatmap Service
emoji: 🗺️
colorFrom: green
colorTo: yellow
sdk: docker
pinned: false
license: mit
---

# AGROW Heatmap Service

This service generates heatmap images from Sentinel-2 satellite data for agricultural field visualization.

## Features

- Generate vegetation index heatmaps (NDVI, EVI, NDWI, NDRE, SMI)
- Custom colormap optimized for agricultural analysis
- Returns images as base64 or direct PNG

## API Endpoints

### POST `/generate-heatmap`

Generate a heatmap for the specified location and index type.

**Request:**
```json
{
  "center_lat": 26.1885,
  "center_lon": 91.6894,
  "field_size_hectares": 10.0,
  "index_type": "NDVI"
}
```

**Response:**
```json
{
  "success": true,
  "index_type": "NDVI",
  "min_value": 0.2,
  "max_value": 0.85,
  "mean_value": 0.65,
  "image_base64": "...",
  "timestamp": "2025-12-05T10:30:00"
}
```

### GET `/generate-heatmap-image`

Get heatmap as PNG image directly.

**Query Parameters:**
- `center_lat`: Field center latitude
- `center_lon`: Field center longitude
- `field_size_hectares`: Field size (default: 10.0)
- `index_type`: Index type (default: "NDVI")

## Supported Indices

| Index | Description |
|-------|-------------|
| NDVI  | Normalized Difference Vegetation Index - General crop health |
| EVI   | Enhanced Vegetation Index - Dense vegetation monitoring |
| NDWI  | Normalized Difference Water Index - Water/moisture content |
| NDRE  | Normalized Difference Red Edge Index - Chlorophyll content |
| SMI   | Soil Moisture Index - Soil water content |

## Environment Variables

Required secrets in HF Space:
- `SH_CLIENT_ID`: Sentinel Hub client ID
- `SH_CLIENT_SECRET`: Sentinel Hub client secret