Interactive web tool for visually verifying coconut plantation training labels across all 38 districts of Tamil Nadu. Built for collaborative validation of the Descals et al. (2023) coconut training dataset using Google satellite imagery.
Coconut plantation mapping using satellite imagery requires high-quality training labels. The Descals et al. (2023) dataset provides raster-based coconut labels derived from Sentinel-2 imagery, but visual verification against high-resolution satellite imagery is essential to assess label accuracy.
This tool vectorizes the raster labels into 90,438 individual polygons, overlays them on Google Satellite imagery, and provides a streamlined interface for multiple users to collaboratively verify whether each polygon actually represents a coconut plantation.
| Metric | Value |
|---|---|
| Total polygons | 90,438 |
| Total coconut area | 245,569 ha (2,456 km²) |
| Districts covered | 38 |
| Source raster | labels_coconut_raw_2020_tamilnadu.tif |
| Sentinel-2 resolution | ~20 m |
| CRS | EPSG:4326 (WGS84) |
| Area projection | UTM Zone 44N (EPSG:32644) |
- District-based navigation — Select any of 38 districts; polygons load on demand
- District boundary outline — White dashed boundary shows the district extent on the map
- Polygon overlay toggle — Show/hide the training label overlay to inspect the satellite image beneath
- One-click verification — Mark each polygon as "Coconut" or "Not Coconut"
- Auto-advance — Automatically moves to the next polygon after verification
- Progress tracking — Real-time progress bar with Yes / No / Pending counts
- Filter polygons — View All, Pending, Yes, or No polygons in the sidebar
- Shared cloud backend — Verifications are stored in Google Sheets via Apps Script
- Multi-user support — Each user enters their name; verifications are attributed (e.g., "by Athithiyan")
- Real-time sync — Auto-refreshes every 60 seconds; manual Refresh button available
- Conflict-safe — Assign different districts to different people to avoid overlap
- Leaflet.draw integration — Draw new coconut polygons directly on the map for areas not in the training set
- Metadata capture — Each drawn polygon records the user, area (ha), timestamp, and a note
- Shared storage — Drawn polygons are saved to the cloud and visible to all users
- Delete support — Only the user who drew a polygon can delete it
| Export | Scope | Format |
|---|---|---|
| Export District (CSV) | Current district | CSV with polygon ID, area, lat/lon, status, verifier, timestamp |
| Export District (GeoJSON) | Current district | GeoJSON with geometry + verification attributes |
| Export All Districts (CSV) | All 38 districts | Combined CSV with summary header (90,438+ rows) |
| Export All Districts (GeoJSON) | All 38 districts | Full FeatureCollection with all polygons + drawn polygons |
| Google Sheet | All data | Raw verification rows, downloadable anytime |
All exports include a source column: training_label for original polygons, user_drawn for manually drawn ones.
| Key | Action |
|---|---|
Y |
Mark as Coconut |
N |
Mark as Not Coconut |
S / Space |
Skip to next |
T |
Toggle overlay on/off |
← / → |
Previous / Next polygon |
Esc |
Close verification panel |
GitHub Pages (frontend) Google Sheets (backend)
┌────────────────────────┐ ┌──────────────────────────┐
│ index.html │ │ verifications tab │
│ style.css │ ───► │ key | status | user | ts │
│ app.js │ GET │ │
│ data/*.geojson │ POST │ drawn_polygons tab │
│ Leaflet + Leaflet.draw │ ◄─── │ id | district | geom... │
└────────────────────────┘ └──────────────────────────┘
│ │
▼ ▼
Google Satellite Apps Script Web App
Tiles (basemap) (CORS-enabled JSON API)
- Frontend: Static HTML/CSS/JS hosted on GitHub Pages — zero build step
- Maps: Leaflet.js with Google Satellite + Labels basemap
- Drawing: Leaflet.draw plugin (polygon tool only)
- Backend: Google Apps Script web app → reads/writes Google Sheets
- Data: Per-district GeoJSON files + district boundary GeoJSON
Just open the live tool — no setup needed to browse polygons and view the map.
To enable saving verifications across users:
- Go to sheets.google.com → create a new blank spreadsheet
- Name it "Coconut Verifier Data"
- Rename the first sheet tab to
verifications - Add headers in Row 1:
key|status|user|timestamp - Create a second sheet tab named
drawn_polygons - Add headers in Row 1:
id|district|geometry|area_ha|user|timestamp|note
- In the Google Sheet → Extensions → Apps Script
- Delete any existing code
- Paste the contents of
google_apps_script.jsfrom this repository - Click Deploy → New Deployment
- Type: Web app | Execute as: Me | Access: Anyone
- Click Deploy → Authorize → Copy the Web App URL
- Edit
app.jsline 8 - Replace
PASTE_YOUR_APPS_SCRIPT_URL_HEREwith your Web App URL - Commit and push — GitHub Pages will update in ~1 minute
git clone https://github.com/Athithiyanmr/coconut_verification_tool.git
cd coconut_verification_tool
python -m http.server 8000
# or: npx serve .Open http://localhost:8000 in your browser.
The raw raster was processed into web-ready GeoJSON using Python:
labels_coconut_raw_2020_tamilnadu.tif
│
▼ rasterio.features.shapes() — vectorize coconut pixels (value=1)
90,438 raw polygons
│
▼ geopandas.sjoin() — assign each polygon to a district
Polygons tagged with district name
│
▼ Reproject to UTM 44N (EPSG:32644) — calculate area in hectares
Area calculated per polygon
│
▼ Unique ID per district (1, 2, 3... per district)
Polygons numbered for systematic verification
│
▼ Simplify geometry + round coordinates to 5 decimal places
Web-optimized GeoJSON per district
│
▼ district_boundaries.geojson — simplified district outlines
38 files in data/ folder
| District | Polygons | Area (ha) | Area (km²) |
|---|---|---|---|
| Coimbatore | 9,235 | 61,469 | 614.7 |
| Tiruppur | 12,091 | 35,379 | 353.8 |
| Kanniyakumari | 3,968 | 24,562 | 245.6 |
| Theni | 3,803 | 20,327 | 203.3 |
| Dindigul | 6,077 | 13,782 | 137.8 |
| Erode | 7,364 | 10,194 | 101.9 |
| Krishnagiri | 4,515 | 9,000 | 90.0 |
| Namakkal | 4,058 | 8,152 | 81.5 |
| Tenkasi | 3,245 | 8,120 | 81.2 |
| Vellore | 3,155 | 7,498 | 75.0 |
coconut_verification_tool/
├── index.html # Main page
├── style.css # Styles
├── app.js # Application logic
├── google_apps_script.js # Google Apps Script (paste into Apps Script editor)
├── server.js # Optional Express backend (for local/self-hosted use)
├── README.md
├── data/
│ ├── districts.json # District index (name, polygon count, center, bounds, file path)
│ ├── district_boundaries.geojson # Simplified district outlines for map display
│ ├── ariyalur.geojson # Per-district polygon data
│ ├── chennai.geojson
│ ├── coimbatore.geojson
│ └── ... (38 district files)
| Component | Technology |
|---|---|
| Maps | Leaflet.js 1.9.4 |
| Basemap | Google Satellite + Labels tiles |
| Drawing | Leaflet.draw 1.0.4 |
| Backend | Google Apps Script Web App |
| Storage | Google Sheets |
| Hosting | GitHub Pages |
| Fonts | DM Sans (Google Fonts) |
- Descals, A., et al. (2023). High-resolution map of coconut palms using deep learning and openly available satellite images. Zenodo dataset
- Sentinel-2 satellite imagery: Copernicus Programme
- Tamil Nadu district boundaries: Survey of India
MIT
Athithiyan — GitHub | Geospatial Data Analyst & Climate Scientist
Built with geospatial Python (rasterio, geopandas, shapely) and vanilla web technologies.