Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

GEEDEF-Land-Cover-Classification-Tools

GEEDEF is a cloud-based, interactive land cover classification tool built entirely within the Google Earth Engine (GEE) Code Editor using the GEE JavaScript API. It is designed to accelerate supervised land cover mapping workflow with full GUI panel

Repositori di GitHub · Halaman web

Platform: Google Earth Engine (JavaScript API) | Data: Sentinel-2A SR Harmonized | Version: V3.1

Open in GEE Sentinel-2 ML Lang Institution Updated


🆕 What’s New in V3.1

Updated from V3 (original PDF release). The following features were added in the latest version accessible via the updated GEE link.

#New FeatureDescription
1📥 Import Training Samples from SHP AssetFully new sub-panel in Step 4 — load existing training data from a GEE FeatureCollection asset (uploaded SHP), auto-read attribute columns, extract unique classes, map class codes and names, and merge with manually digitized samples
2📖 Read ColumnsDedicated button to read and populate attribute column dropdowns from the selected SHP asset — eliminates manual column name entry
3🔍 Extract Unique ClassesScans the selected SHP asset for all unique numeric class codes and renders an editable row per class (name + color) before import
4🔄 Dual Asset RefreshSeparate asset refresh inputs for both the ROI boundary and the training sample SHP — previously only one input field existed
5⚠️ Accuracy Penalty FlagIf only manual samples are used (no field-validated asset imported), the tool applies a −5% correction to OA and Kappa and displays a warning note — makes the reliability of the assessment transparent
6🌐 Bilingual UI (EN / ID)Full interface toggle between English and Bahasa Indonesia via EN / ID buttons on the map — all labels, buttons, placeholders, and status messages switch dynamically
7📋 Hex Color Copy BoxEach class in the palette panel now renders an editable hex code textbox next to the class button — allows direct copy without needing to memorize or retype the color code

Overview

GEEDEF is a cloud-based, interactive land cover classification tool built entirely within the Google Earth Engine (GEE) Code Editor using the GEE JavaScript API. It is designed to accelerate supervised land cover mapping workflows at regional and local scales using Sentinel-2A Surface Reflectance (SR) Harmonized imagery.

The tool integrates three scientifically established machine learning classifiers — Random Forest (RF), Gradient Tree Boost (GTB), and Support Vector Machine (SVM) — operating over a 26-variable feature space composed of 10 native spectral bands and 16 derived spectral indices. The entire workflow, from image compositing and sample digitization to accuracy assessment and GeoTIFF export, is executed server-side on Google’s distributed computing infrastructure.

Developed by: Defani Arman Alfitriansyah
Institution: Faculty of Forestry and Environmental Science, Universitas Kuningan
Year: 2025


Table of Contents

  1. Prerequisites

  2. Interface Layout

  3. Six-Step Workflow

  4. Feature Space

  5. Spectral Index Formulas

  6. Land Cover Palette Schemes

  7. Tips and Troubleshooting

  8. Full Script Repository

  9. Scientific References


Prerequisites

RequirementDetails
GEE AccountActive account at earthengine.google.com
Internet ConnectionStable connection required for server-side computation
ROI BoundaryAs a GEE FeatureCollection asset, or drawn manually on the map
Domain KnowledgeBasic understanding of land cover concepts and satellite image interpretation

Interface Layout

GEEDEF uses a three-panel side-by-side layout:

Screenshot 2026-05-02 200728

Six-Step Workflow

All six steps must be executed sequentially. Skipping any step will trigger a warning in the status panel.


Step 1 — Define Region of Interest (ROI)

The ROI defines the spatial extent for image collection filtering, classifier training, and area calculation. Two methods are available:

Method A — Load from GEE Asset

  1. Enter your GEE account or project name in the text field (e.g., ee-defaniarman).

  2. Click 🔄 Refresh Assets to populate the dropdown with available FeatureCollection assets.

  3. Select the boundary SHP from the dropdown.

  4. Click 📥 Load ROI from Dropdown.

  5. The map centers on the loaded ROI and displays the boundary as a blue outline.

Method B — Manual Drawing

  1. Activate the Drawing Tools from the top-left map toolbar (pencil icon).

  2. Draw a polygon defining your study area boundary.

  3. Click 🖊 Use Map Drawing Tools.

Recommendation: For district-scale or larger study areas, Method A is preferred to ensure administrative boundaries match official data.


Step 2 — Sentinel-2A Composite Acquisition

Builds a cloud-free image composite from COPERNICUS/S2_SR_HARMONIZED according to user-defined parameters.

Acquisition Parameters

ParameterDescriptionDefault
Date RangeStart and end date in YYYY-MM-DD format2024-01-01 to 2024-12-31
Cloud Max (%)Maximum CLOUDY_PIXEL_PERCENTAGE per scene20%
Cloud MaskingEnable/disable pixel-level cloud maskingEnabled
Composite MethodTemporal aggregation strategyMedian

Cloud Masking Methods

MethodDescriptionRecommendation
Cloud Score+Uses cs_cdf layer; masks pixels with cs_cdf < 0.60✅ Recommended — highest accuracy (Pasquarella et al., 2023)
SCL (ESA)Removes SCL classes: cloud shadow (3), unclassified (7), medium cloud (8), high cloud (9), thin cirrus (10), snow/ice (11)Suitable for most tropical regions
QA60 (Bitmask)Uses bit 10 (opaque cloud) and bit 11 (cirrus cloud)Simplest but least precise

Temporal Composite Methods

MethodDescriptionBest Use
Median (Default)Pixel-wise median across all scenes in date rangeAnnual mapping; stable and representative
Median Dry SeasonSelects lowest NDVI quartile (25% driest scenes)Spectral contrast between open land and vegetation
Median Wet SeasonSelects highest NDVI quartile (25% greenest scenes)Maximizing vegetation response

Step 3 — Classification Algorithm & Parameters

Random Forest (RF)

ParameterRangeDefaultDescription
numTrees50–1000500Number of decision trees
minLeafPopulation1–201Minimum samples per terminal leaf
bagFraction0.3–1.00.5Proportion of samples per tree

Gradient Tree Boost (GTB)

ParameterRangeDefaultDescription
numTrees50–500200Number of boosting iterations
shrinkage0.01–0.300.05Learning rate
samplingRate0.30–1.00.7Proportion of samples per iteration
maxNodes2–105Maximum depth per tree
loss—LeastAbsoluteDeviationLoss function

Support Vector Machine (SVM)

ParameterRangeDefaultDescription
kernelRBF / LINEAR / POLY / SIGMOIDRBFKernel function
cost (C)0.1–10010Regularization parameter
gamma0.001–2.00.5Influence range (RBF, POLY, SIGMOID)
degree1–103Polynomial degree (POLY only)
coef00.0–5.00.0Independent coefficient (POLY, SIGMOID)

Training / Testing Split

Default 70/30. Use 80/20 for datasets with fewer than 200 samples per class. Minimum 20–30 polygons per class required for statistically valid accuracy evaluation.


Step 4 — Add Classes & Digitize Training Samples

Option A — Import from SHP Asset (New in V3.1)

  1. Enter your GEE account/project name and click 🔄 Refresh to load available SHP assets.

  2. Select the training sample asset from the dropdown.

  3. Click 📖 Read Columns to populate attribute column dropdowns.

  4. Select the class code column and the class name/label column.

  5. Click 🔍 Extract Unique Classes — an editable row appears for each class (name + color).

  6. Edit names and colors as needed, then click 📥 Save & Import Mapped Samples.

Imported samples are merged with any manually digitized samples before training.

Option B — Manual Class Entry

  1. Type a class name, or click a class from the Left Panel palette for auto-fill.

  2. Enter the hexadecimal color code (e.g., #006400).

  3. Click + ADD CLASS — codes are assigned automatically and increment sequentially.

Digitizing Samples

  1. Select the active class from the dropdown.

  2. Activate Drawing Tools (top-left of map); choose point or polygon.

  3. Draw sample areas on the map for the selected class. Repeat for all classes.

Best practice: Distribute samples spatially. Use multiple small polygons per class to capture within-class spectral variability. Avoid transitional or ambiguous zones.


Step 5 — Run Classification

Click 🚀 RUN CLASSIFICATION. The tool executes server-side:

  1. Extracts spectral values (26 variables) from all samples via sampleRegions

  2. Randomly splits samples into training / validation sets using randomColumn

  3. Trains the classifier on the training set

  4. Classifies all pixels within the ROI

  5. Computes error matrix → derives OA and Kappa from the validation set

  6. Calculates per-class area via ee.Image.pixelArea() in hectares

Accuracy Interpretation

MetricThresholdNote
Overall Accuracy (OA)> 85%Generally accepted for regional land cover studies
Kappa Coefficient> 0.80“Very Strong” agreement (Landis & Koch, 1977)

⚠️ If only manual samples are used (no imported field-validated asset), a −5% penalty is applied to OA and Kappa and flagged in the results panel.


Step 6 — Export to Google Drive

  1. Set folder name (default: GEE_Export) and filename (default: LandCover_DFRF_V3).

  2. Select output spatial resolution: 10 m, 20 m, or 30 m.

  3. Click ⬆ EXPORT — GeoTIFF to Drive.

  4. Monitor in the Tasks tab (clock icon, top-right of GEE Code Editor). Click Run.

Output is a single-band integer raster (pixel value = class code), CRS: EPSG:4326. Compatible with QGIS, ArcGIS, and all major GIS software.


Feature Space

After loading the composite, GEEDEF automatically computes 16 spectral indices. Together with 10 native Sentinel-2A bands, the total feature space is 26 predictor variables per pixel.

Native Spectral Bands (10)

BandNameWavelengthResolution
B2Blue~490 nm10 m
B3Green~560 nm10 m
B4Red~665 nm10 m
B5Red Edge 1~705 nm20 m
B6Red Edge 2~740 nm20 m
B7Red Edge 3~783 nm20 m
B8NIR~842 nm10 m
B8ANIR Narrow~865 nm20 m
B11SWIR 1~1610 nm20 m
B12SWIR 2~2190 nm20 m

Derived Spectral Indices (16)

IndexFull NamePrimary Application
NDVINormalized Difference Vegetation IndexVegetation density
EVI2Enhanced Vegetation Index 2Canopy structure; reduces atmospheric noise
CAICellulose Absorption IndexBare soil and litter discrimination
NDWINormalized Difference Water IndexLeaf water content
GCVIGreen Chlorophyll Vegetation IndexChlorophyll estimation
SAVISoil-Adjusted Vegetation IndexSparse vegetation over bare soil
PRIPhotochemical Reflectance IndexCanopy light use efficiency
HALL_COVERHall Forest Cover IndexForest canopy cover estimation
IRECIInverted Red-Edge Chlorophyll IndexRed-edge based chlorophyll
NDRENormalized Difference Red EdgeVegetation health and stress
MNDWIModified Normalized Difference Water IndexOpen water body mapping
NDMINormalized Difference Moisture IndexLand moisture
NDBINormalized Difference Built-up IndexUrban and built-up area
NBRNormalized Burn RatioBurned area / forest degradation
GVSGreen Vegetation SignalGreen vegetation fraction
NDFINormalized Difference Fraction IndexForest degradation and fragmentation

Spectral Index Formulas

NDVI=ρB8−ρB4ρB8+ρB4NDVI = \frac{\rho_{B8} - \rho_{B4}}{\rho_{B8} + \rho_{B4}}
EVI2=2.5×ρB8−ρB4ρB8+2.4×ρB4+1EVI2 = 2.5 \times \frac{\rho_{B8} - \rho_{B4}}{\rho_{B8} + 2.4 \times \rho_{B4} + 1}
CAI=ρB12ρB11NDWI=ρB8−ρB11ρB8+ρB11GCVI=ρB8ρB3−1CAI = \frac{\rho_{B12}}{\rho_{B11}} \qquad NDWI = \frac{\rho_{B8} - \rho_{B11}}{\rho_{B8} + \rho_{B11}} \qquad GCVI = \frac{\rho_{B8}}{\rho_{B3}} - 1
SAVI=1.5×(ρB8−ρB4)ρB8+ρB4+0.5PRI=ρB2−ρB3ρB2+ρB3SAVI = \frac{1.5 \times (\rho_{B8} - \rho_{B4})}{\rho_{B8} + \rho_{B4} + 0.5} \qquad PRI = \frac{\rho_{B2} - \rho_{B3}}{\rho_{B2} + \rho_{B3}}
HALL_COVER=−0.017ρB4−0.007ρB8−0.079ρB12+5.22HALL\_COVER = -0.017\rho_{B4} - 0.007\rho_{B8} - 0.079\rho_{B12} + 5.22
IRECI=ρB7−ρB4ρB5/ρB6NDRE=ρB8A−ρB5ρB8A+ρB5MNDWI=ρB3−ρB11ρB3+ρB11IRECI = \frac{\rho_{B7} - \rho_{B4}}{\rho_{B5} / \rho_{B6}} \qquad NDRE = \frac{\rho_{B8A} - \rho_{B5}}{\rho_{B8A} + \rho_{B5}} \qquad MNDWI = \frac{\rho_{B3} - \rho_{B11}}{\rho_{B3} + \rho_{B11}}
NDMI=ρB8−ρB11ρB8+ρB11NDBI=ρB11−ρB8ρB11+ρB8NBR=ρB8−ρB12ρB8+ρB12NDMI = \frac{\rho_{B8} - \rho_{B11}}{\rho_{B8} + \rho_{B11}} \qquad NDBI = \frac{\rho_{B11} - \rho_{B8}}{\rho_{B11} + \rho_{B8}} \qquad NBR = \frac{\rho_{B8} - \rho_{B12}}{\rho_{B8} + \rho_{B12}}
GVS=100×NDVI100∣NDVI∣+100∣NBR∣+1NDFI=GVS−(1−NDVI)GVS+(1−NDVI)GVS = \frac{100 \times NDVI}{100|NDVI| + 100|NBR| + 1} \qquad NDFI = \frac{GVS - (1 - NDVI)}{GVS + (1 - NDVI)}

Land Cover Palette Schemes

Color swatches below are rendered as inline SVG — visible on GitHub and most Markdown renderers.


🇮🇩 KLHK — Indonesian Ministry of Environment and Forestry

IDClass NameSwatchHex
1Hutan Lahan Kering Primer#60E663
2Hutan Lahan Kering Sekunder#72FF00
3Hutan Mangrove Primer#8EA704
4Hutan Mangrove Sekunder#C1A700
5Hutan Rawa Primer#60E663
6Hutan Rawa Sekunder#72FF00
7Hutan Tanaman#D3E598
8Semak Belukar#EBC0A7
9Semak Belukar Rawa#EBC0A7
10Pertanian Lahan Kering#F6FFA7
11Pertanian Lahan Kering Campur#EDF500
12Sawah#A8D6FF
13Tambak#7AF4F4
14Permukiman Transmigrasi#728EA7
15Perkebunan#E5D298
16Permukiman#686868
17Bandara / Pelabuhan#D60073
18Lahan Terbuka#D60073
19Pertambangan#A70400
20Badan Air#D4FCF7
21Rawa#98E5E5
22Savana / Padang Rumput#D5FF02
23Awan#D1D1D1

🌿 MapBiomas Indonesia — Collection 3.0

IDClass NameSwatchHex
3Formasi Hutan#1f8d49
5Mangrove#04381d
76Hutan Rawa Gambut#2f7360
13Tumbuhan Non-Hutan Lainnya#d89f5c
40Sawah#c71585
35Sawit#9065d0
9Kebun Kayu#7a5900
21Pertanian Lainnya#ffefc3
30Lubang Tambang#9c0027
24Permukiman#d4271e
25Non-Vegetasi Lainnya#db4d4f
31Tambak#091077
33Sungai, Danau, Laut#2532e4

🇺🇸 NLCD — National Land Cover Database (USGS)

IDClass NameSwatchHex
11Open Water#466b9f
12Perennial Ice/Snow#d1def8
21Developed, Open Space#dec5c5
22Developed, Low Intensity#d99282
23Developed, Medium Intensity#eb0000
24Developed, High Intensity#ab0000
31Barren Land#b3ac9f
41Deciduous Forest#68ab5f
42Evergreen Forest#1c5f2c
43Mixed Forest#b5c58f
51Dwarf Scrub#af963c
52Shrub/Scrub#ccb879
71Grassland/Herbaceous#dfdfc2
72Sedge/Herbaceous#d1d182
73Lichens#a3cc51
74Moss#82ba9e
81Pasture/Hay#dcd939
82Cultivated Crops#ab6c28
90Woody Wetlands#b8d9eb
95Emergent Herbaceous Wetlands#6c9fb8

Tips and Troubleshooting

General Tips

Common Issues

Error / IssueSolution
"Computation timed out"Reduce ROI extent; increase scale to 20 or 30 m; shorten the date range
"Not enough pixels in region"Use 10 m scale or enlarge the sample polygon area
OA very low (< 70%)Check sample placement; avoid transitional zones; add more samples; merge spectrally similar classes
Class missing from outputEnsure all classes have drawn polygons before clicking Run Classification
Error loading ROI from assetVerify full asset path; asset must be FeatureCollection; check sharing/access settings
Map layer not appearingOpen Layer Manager (top-right of map); enable all layers; zoom out if ROI is small

Full Script Repository

https://code.earthengine.google.com/328e48a66c1f2b0a9268cbce3327b9df

Default Configuration (CFG object)

var CFG = {
  startDate:         '2024-01-01',
  endDate:           '2024-12-31',
  cloudMax:          20,
  classProp:         'lc',
  seed:              42,
  scale:             10,
  maxPix:            1e13,
  splitRatio:        0.7,
  // Random Forest
  rf_numTrees:       500,
  rf_minLeaf:        1,
  rf_bagFraction:    0.5,
  // Gradient Tree Boost
  gtb_numTrees:      200,
  gtb_shrinkage:     0.05,
  gtb_samplingRate:  0.7,
  gtb_maxNodes:      5,
  gtb_loss:          'LeastAbsoluteDeviation',
  // Support Vector Machine
  svm_kernel:        'RBF',
  svm_gamma:         0.5,
  svm_cost:          10,
  svm_degree:        3,
  svm_coef:          0.0
};

Cloud Masking Functions

function maskByCSPlus(image) {
  return image.updateMask(image.select('cs_cdf').gte(0.60));
}

function maskBySCL(image) {
  var scl = image.select('SCL');
  return image.updateMask(
    scl.neq(3).and(scl.neq(7)).and(scl.neq(8))
       .and(scl.neq(9)).and(scl.neq(10)).and(scl.neq(11))
  );
}

function maskByQA60(image) {
  var qa = image.select('QA60');
  return image.updateMask(
    qa.bitwiseAnd(1 << 10).eq(0).and(qa.bitwiseAnd(1 << 11).eq(0))
  );
}

Export Configuration

Export.image.toDrive({
  image:          STATE.classifiedImg,
  description:    'LandCover_DFRF_V3',
  folder:         'GEE_Export',
  fileNamePrefix: 'LandCover_DFRF_V3',
  region:         STATE.roi.geometry(),
  scale:          10,           // options: 10, 20, 30
  crs:            'EPSG:4326',
  maxPixels:      1e13,
  fileFormat:     'GeoTIFF'
});

Scientific References

Auriga Nusantara. (2024). Algorithm Theoretical Basis Document (ATBD) MapBiomas Indonesia Koleksi 3 Versi 1. MapBiomas Indonesia.

Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5–32.

Cardille, J. A., Crowley, M. A., Saah, D., & Clinton, N. E. (Eds.). (2024). Cloud-based remote sensing with Google Earth Engine: Fundamentals and applications. Springer International Publishing. Springer International Publishing (2024)

Cortes, C., & Vapnik, V. (1995). Support-vector networks. Machine Learning, 20(3), 273–297.

Friedman, J. H. (2001). Greedy function approximation: A gradient boosting machine. Annals of Statistics, 29(5), 1189–1232.

Gorelick, N., Hancher, M., Dixon, M., Ilyushchenko, S., Thau, D., & Moore, R. (2017). Google Earth Engine: Planetary-scale geospatial analysis for everyone. Remote Sensing of Environment, 202, 18–27. Gorelick et al. (2017)

Kementerian Lingkungan Hidup dan Kehutanan Republik Indonesia. (2024). Keputusan Menteri Lingkungan Hidup dan Kehutanan Nomor 399 Tahun 2024 tentang Standar Penyebarluasan Informasi Geospasial Tematik Lingkup KLHK. KLHK.

Landis, J. R., & Koch, G. G. (1977). The measurement of observer agreement for categorical data. Biometrics, 33(1), 159–174.

Pasquarella, V. J., Brown, C. F., Czerwinski, W., & Rucklidge, W. J. (2023). Comprehensive quality assessment of optical satellite imagery using weakly supervised video learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (pp. 2125–2135). Pasquarella et al. (2023)

U.S. Geological Survey. (2025). Annual National Land Cover Database (NLCD) Collection 1 Science Product User Guide (Version 1.1). USGS.

U.S. Geological Survey. (n.d.). National Land Cover Database (NLCD) class legend and description. USGS.

This tool is released for academic and educational use. All imagery access is subject to Google Earth Engine Terms of Service and Copernicus Sentinel-2 data policies.

References
  1. Cloud-Based Remote Sensing with Google Earth Engine: Fundamentals and Applications. (2024). Springer International Publishing. 10.1007/978-3-031-26588-4
  2. Gorelick, N., Hancher, M., Dixon, M., Ilyushchenko, S., Thau, D., & Moore, R. (2017). Google Earth Engine: Planetary-scale geospatial analysis for everyone. Remote Sensing of Environment, 202, 18–27. 10.1016/j.rse.2017.06.031
  3. Pasquarella, V. J., Brown, C. F., Czerwinski, W., & Rucklidge, W. J. (2023). Comprehensive quality assessment of optical satellite imagery using weakly supervised video learning. 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), 2125–2135. 10.1109/cvprw59228.2023.00206