LEE RS Lab — User guide
📖
Full manual — 15 step-by-step lessons with annotated screenshots (Khmer, Kampong Tralach example):
read online ·
download the PDFThis page is the short guide and works offline.Workflow
| 1 Data | Area of interest: country → province → district → commune (any country, Cambodia preset with Khmer names; “— whole country —”), map extent, drawn box or polygon layer; the project CRS follows the AOI's UTM zone. Imagery — search scenes (default Microsoft Planetary Computer): Sentinel-2 L2A, Landsat 5/7/8/9 L2, Sentinel-1 RTC; Earth Search (AWS); or local band files. Composite & download: cloud masks are checked first so only clear scenes are read; median, mean, p25, min, greenest, least-cloudy or selected scenes. More datasets: Copernicus DEM, NASADEM, ESA WorldCover, annual land cover, JRC surface water, MODIS NDVI. ⚙ Setup: output folder, connection test, scikit-learn, boundary cache, log. |
|---|
| 2 Enhance | Band combination presets and stretches, histograms, statistics, spectral profile tool · NDVI, EVI, SAVI, NDWI, MNDWI, NDMI, NDBI, NBR, BSI, GNDVI, NDRE, UI, RVI and your own band math, Otsu mask · spatial filters · PCA. |
|---|
| 3 Classify | Classes (legend) shared by all steps, with schemes (RS Lab, LULC level 1, Auto 7, ESA WorldCover) · K-means / ISODATA and cluster labelling, with a multi-season stack (Sentinel-2 Feb–Apr and Sep–Nov + Sentinel-1, built locally for the AOI), a hint per cluster, click a row to fly to example pixels, suggest classes from hints and split a mixed cluster · classes, training polygons — drawn by hand or with the 🪄 magic wand (click one pixel: similar connected pixels become a polygon of the chosen class; tolerance, max. area, undo) —, signatures, J–M separability, feature space · Minimum Distance, Maximum Likelihood, SAM, Parallelepiped, Random Forest, SVM, kNN · automatic training points from ESA WorldCover · accuracy: Cochran sample size (proportional / equal allocation, minimum per class), point labelling with class buttons, validation points, confusion matrix, OA, kappa, user's / producer's accuracy and area-adjusted areas with 95 % confidence intervals (Olofsson et al. 2014) · Clean up & export polygons: sieve to a minimum mapping unit, polygons with class name and area · Map layout: A4 map with legend, scale bar, north arrow, sources, accuracy. |
|---|
| 4 Change | From → to between two classified maps: matrix (ha), gains / losses / net per class, largest transitions, Sankey diagram, date 1 vs date 2 area chart, map of one chosen transition (e.g. Forest → Cropland), CSV; or image differencing. |
|---|
| 5 LEE | LEE — Local Earth Engine: GEE-style scripts (ImageCollection, filterDate, median, normalizedDifference, Map.addLayer, timeSeries…) that run on your computer with free data; 32 examples (vegetation, indices, red edge, land surface temperature, urban expansion, forest loss, rice calendar from Sentinel-1, radar, water, flood, burn, drought, terrain, land cover, historical Landsat, data quality); API reference lists every function. lee.Image.open("layer name") reads a project raster; Use a result in the other tabs sends outputs to Enhance, Classify, Accuracy or Change. |
|---|
| Header | Basic / Advanced: Basic (default) shows only the main steps — filters, PCA, ISODATA, extra algorithms, signatures, WorldCover training, polygon export and the LEE tab are hidden; Advanced shows every tool · Language · basemap menu (also on the toolbar icon's arrow) · Help · PDF report. |
|---|
Lessons
Where the data come from
RS Lab needs no account and no login. Satellite images are read from free, open STAC catalogues of
Cloud-Optimised GeoTIFFs: Microsoft Planetary Computer and Earth Search (Amazon Web Services).
A COG lets QGIS read only the pixels inside your AOI, so you never download a whole 100 km scene.
Composites, indices and classifications are computed on your own computer.
Use Test connections to check that every source can be reached from your network.
Satellite images and their levels
Level-1 / TOA = reflectance measured at the top of the atmosphere (includes haze).
Level-2 / SR = surface reflectance after atmospheric correction — best for analysis.
Raw DN are the integers stored by the provider (Sentinel-2: reflectance × 10000;
Landsat C2 L2: reflectance = DN × 0.0000275 − 0.2). Scaled converts them to 0–1 reflectance.
A composite combines many dates pixel by pixel; the median removes most clouds and shadows.
Spatial resolution: Sentinel-2 10–60 m, Landsat 30 m (15 m pan), Sentinel-1 10 m.
Band composites and contrast enhancement
A screen shows three colours (Red, Green, Blue). We can put any three bands into them.
True colour = Red, Green, Blue bands. False colour (NIR, Red, Green) shows healthy vegetation in red
because leaves reflect near-infrared strongly.
Raw values occupy a narrow range, so images look dark. Contrast stretching maps that range to
0–255: min–max, percent clip (ignore the 2% extremes), standard deviation, and
histogram equalization (spreads values so each grey level has equal frequency).
Use the spectral profile tool to click pixels and compare their spectral signatures.
Spectral indices
An index combines bands to highlight one feature and reduce illumination effects.
NDVI = (NIR − Red)/(NIR + Red): water < 0, bare soil ≈ 0.1–0.2, dense vegetation > 0.6.
MNDWI uses Green and SWIR to map water; NDBI highlights built-up areas; NBR shows burnt areas.
Otsu chooses a threshold automatically from the histogram (e.g. water / non-water).
Indices must be computed on reflectance; on raw DN the ratio is the same for SR bands but
not for indices with constants (EVI, SAVI) — use scaled reflectance for those.
Spatial filters and PCA
A filter moves a small window (kernel) over the image. Low-pass (mean, Gaussian, median)
smooths noise; high-pass sharpens; edge filters (Sobel, Laplacian) find boundaries such as
roads, canals and field edges. Median keeps edges better than mean.
Principal Component Analysis rotates correlated bands into uncorrelated components. PC1 holds
most of the variance (overall brightness); later PCs hold contrasts and noise.
Unsupervised classification
The computer groups pixels with similar spectra into clusters without any training data.
K-means: choose k, assign each pixel to the nearest cluster centre, move centres, repeat.
ISODATA also splits wide clusters, merges close ones and removes tiny ones.
Afterwards the analyst must label each cluster (e.g. cluster 3 = water) using the image and
local knowledge. Ask for more clusters than classes, then merge them by giving the same name.
Supervised classification
- Define classes (id, name, colour).
- Digitize training polygons over pure, typical areas of each class — spread them across the
whole image, at least 10–20 polygons per class.
- Check the signatures and separability (Jeffries–Matusita > 1.9 = good; < 1.0 = classes overlap).
- Choose a classifier: Minimum Distance (nearest class mean), Parallelepiped (box of ±k·σ),
Maximum Likelihood (Gaussian probability, uses covariance), Spectral Angle Mapper
(shape of the spectrum, ignores brightness), Random Forest / SVM (machine learning).
- Smooth with a majority filter, then assess accuracy with independent reference data.
Accuracy assessment
Compare the map with reference data that were not used for training. The confusion
(error) matrix has map classes in rows and reference classes in columns.
Overall accuracy = correct / total. Producer's accuracy = correct / column total
(1 − omission error). User's accuracy = correct / row total (1 − commission error).
Kappa corrects for chance agreement (> 0.8 strong, 0.4–0.8 moderate).
Generate stratified random points, label each one from high-resolution imagery or field
visits in the field ref_class, then compute.
Change detection
Image differencing: subtract an index (e.g. NDVI) of date 1 from date 2. Large negative values =
loss (deforestation, flooding, harvest); large positive = gain. Thresholds at mean ± k·σ.
Post-classification comparison: classify both dates, then cross-tabulate them in a
change matrix ("from → to"). It tells what changed into what, but errors of both
maps add up. Both images should be from the same season and sensor if possible.
Scripting like Google Earth Engine — on your own computer (LEE)
A script describes a collection of images (dataset, dates, place, cloud limit), reduces it to one image
(median(), mean(), qualityMosaic()…), computes new bands
(normalizedDifference, expression, slope…) and shows results with
Map.addLayer, print and charts. Only the AOI pixels are read, clouds are masked
automatically and reflectance is already 0–1. Choose an example, change dates or thresholds, press Run.
Large AOIs are computed at coarser pixels — set lee.config(scale=30) yourself to go faster.
YAM Sarath · github.com/khgeo · data: Microsoft Planetary Computer, Element 84 Earth Search, OCHA HDX, geoBoundaries, Open Development Cambodia