Skip to content

Class Last Year

João Siqueira edited this page Nov 10, 2026 · 4 revisions

Script: codes/analysis_7_last_year.js. The calculation is in the function getClassLastYear.

Description: Returns the most recent year in which the pixel was classified as the targetClass. Its counterpart is Class First Year, the earliest year. Time Since Last Occurrence expresses it as years elapsed until 2024.

What it shows: It maps the temporal footprint of a class: where a class is no longer present, it tells when it was last seen. In the example, pixel C left pasture in 2010 and pixel D in 2018; pixel A is still pasture, so its value is the last year of the series, 2024.

Class last year on the four example pixels: A 2024, B masked, C 2010, D 2018

Parameters

Set at the top of the script; change them before running.

variable default meaning
targetClass 15 (Pasture) class of interest, a MapBiomas legend code
asset Collection 10.1 coverage asset the multi-band image read by the script
years 1985 … 2024 years included in the series
bandPrefix 'classification_' band names are bandPrefix + year

Map layers

Besides a land cover reference layer (hidden by default), the script adds:

layer value colors
Class 15 Last Year most recent year in the class yellow (earlier) to dark red (recent)

Pixels with no result are masked and appear transparent.

How to run

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.


← 6. Class First Year · Home · 8. Time Since Last Occurrence →

Clone this wiki locally