Repository navigation
Transitions
Script: codes/analysis_10_transitions.js.
Description: Combines the class of 2008 and the class of 2024 in a single code by map algebra, class_2008 × 100 + class_2024: the first digits are the 2008 class and the last two the 2024 class. Each map layer then selects the codes of one transition of interest; other codes are transparent. Only the two years are compared: what happens in between does not change the code.
What it shows:
- Forest → soy: Forest (class 3) converted to Soybean (class 39) gives code 339 (pixel D in the example).
- Pasture or mosaic → forest: Pasture (15) or Mosaic of Uses (21) back to Forest (3) gives codes 1503 or 2103, grouped in one layer (pixel C in the example).
Pixels A (1515) and B (303) match neither transition and do not appear in either layer.
Set at the top of the script; change them before running.
| variable | default | meaning |
|---|---|---|
asset |
Collection 10.1 coverage asset | the multi-band image read by the script |
start_year |
2008 |
first year of the comparison |
end_year |
2024 |
second year of the comparison |
Besides a land cover reference layer (hidden by default), the script adds:
| layer | value | colors |
|---|---|---|
forest_2008 to soy_2024 |
1 where the code is 339 | dark red |
pasture_or_mosaic_2008 to forest_2024 |
1 where the code is 1503 or 2103 | bright green |
Pixels with no result are masked and appear transparent.
Copy the whole script into the Google Earth Engine Code Editor, adjust the parameters and click Run. See Home for the example pixels used in the figure.