I have used the following function to calculate the area of an area of interest (AOI) of a classification using landsat8 images. This counts the area in square meters of the classification for a given polygon.
var areaChart = ui.Chart.image.byClass({
image: ee.Image.pixelArea().addBands(lista_imagenes[0]),
classBand: 'classification',
region: geometry,
scale: 30,
reducer: ee.Reducer.sum()
});
The problem is that the band of classification of landsat8 is just one (classification band). And the layer I am using has three layers (it is call year of loss).
There is any way to count the classes of the layer given a polygon using a similar question?
Here the code: https://code.earthengine.google.com/495ed315756b7181b4570546be82e2f4