I was working with a land cover classification image from alberta. Documentation states that there are 14 categories. Nonetheless, when exploring the categories, there are 14 but category 0 are unclassified pixels. To explore further matches, I wanted to plot every category separately and verified with the satellite image what was there. The code is the following:
var image = ee.Image('projects/ee-eoagsaer/assets/LULC_2022_EE');
var vizParams = {
min: 0,
max: 1,
palette: ['red'] // You can change the color to distinguish different categories
};
// Define a function to mask a specific category
var maskCategory = function(image, category) {
return image.updateMask(image.eq(category));
};
// List of categories you want to map
var categories = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
// Iterate through the categories and add them to the map
categories.forEach(function(category) {
var maskedImage = maskCategory(image, category);
Map.addLayer(maskedImage, vizParams, 'Category ' + category);
});
I was working with a land cover classification image from alberta. Documentation states that there are 14 categories. Nonetheless, when exploring the categories, there are 14 but category 0 are unclassified pixels. To explore further matches, I wanted to plot every category separately and verified with the satellite image what was there. The code is the following: