mean
elevation 348.3366
By the end of this lesson you will be able to:
Trade-off example: Sentinel-2: 10 m · 5 days · 13 bands vs. MODIS: 500 m · daily · 36 bands — higher resolution in one dimension typically comes at the cost of another.
DN vs. Reflectance
Calibration pipeline:
| Step | Corrects for |
|---|---|
| DN → Radiance | Sensor gain & offset |
| Radiance → TOA Reflectance | Solar illumination angle |
| TOA → Surface Reflectance | Atmospheric scattering & absorption |
Spectral indices are designed to work with reflectance: more sensor- and date-independent than raw DN.
Figure 1: Local (one cell), Focal (3×3 neighborhood), Zonal (coloured regions), Global (entire raster)
Figure 2: Elevation of Luxembourg
distanceWhat is the mean altitude per municipality?
Figure 3
classify\[B = 0.5 \times R + 0.3 \times G + 0.2 \times B\]
Healthy vegetation has a characteristic spectral signature:
Numbers indicate Landsat TM bands: 1 Blue, 2 Green, 3 Red, 4 NIR, 5 SWIR1, 7 SWIR2 (band 6 thermal, off-chart). Source: seos-project.eu
\[\text{Index} = \frac{A - B}{A + B} \in [-1,\, +1]\]
Normalization reduces the effect of illumination differences.
| Index | Formula | Detects |
|---|---|---|
| NDVI | (NIR − Red) / (NIR + Red) | Vegetation density |
| NDWI | (Green − NIR) / (Green + NIR) | Open water |
| NDSI | (Green − SWIR) / (Green + SWIR) | Snow & ice |
| NBR | (NIR − SWIR) / (NIR + SWIR) | Burn severity |
Note
For example, a laplacian filter is commonly used for edge detection.
[,1] [,2] [,3]
[1,] 0 1 0
[2,] 1 -4 1
[3,] 0 1 0
So are the sobel filters — shown on the next slide.
Figure 6
A focal operation with a weight matrix is a discrete convolution:
\[(\text{output})_{i,j} = \sum_{m}\sum_{n} w_{m,n} \cdot r_{i+m,\, j+n}\]
This is exactly the operation in convolutional neural networks (CNNs):
| Hand-crafted kernel | Equivalent CNN concept |
|---|---|
| Gaussian blur | Smoothing / anti-aliasing layer |
| Sobel x/y | Edge detection layer |
| Mean filter | Average pooling |
The key difference: in deep learning, kernels are learned from data rather than designed manually.
0.008333333 (see res(r)) and since our raster is in WGS84, the units is “degrees”.[1] 0.008333333 0.008333333
focalMatfocalMat creates focal matrices in real-world units (CRS units)d = radius), rectangle (d = dimensions), Gauss (d = sigma) [,1] [,2] [,3]
[1,] 0.00000000 0.09090909 0.00000000
[2,] 0.09090909 0.09090909 0.09090909
[3,] 0.09090909 0.09090909 0.09090909
[4,] 0.09090909 0.09090909 0.09090909
[5,] 0.00000000 0.09090909 0.00000000
Circle filter (2 km radius)
focalMat — GaussGaussian filter (sigma = 2 km)
terrain())Figure 7
Vector data represents discrete geometries: points, lines, polygons — each with a geometry and attributes.
Three fundamental operations linking rasters and vectors:
| Operation | Function | What it does |
|---|---|---|
| Crop | crop() |
Reduce raster extent to bounding box of vector |
| Mask | mask() |
Set cells outside vector geometry to NA |
| Extract | extract() |
Get raster cell values at vector locations |
Figure 8
ID elevation
1 1 226
2 2 278
3 3 359
4 4 380
5 5 294
extract() also accepts polygon geometries and an aggregation function:
| Type | Scope | Key functions |
|---|---|---|
| Global | Entire raster | global(), distance() |
| Zonal | Defined regions | zonal(), rasterize() |
| Local | Per cell | classify(), >, &, spectral indices |
| Focal | Moving window | focal(), focalMat(), terrain() |
| Vector ops | Geometry-based | crop(), mask(), extract() |