1

My question concerns code from Displaying landcover classes using Google Earth Engine.

I tried to apply the code in the answer to the new V20 data set, but I doesn't seem to work the same way. If I change the version it doesn't visualize the data and everything seems to be masked.

To try and solve the problem and because I'm interested in the 2018 data I changed the code to:

//Load Corine Image 2018
var corine = ee.Image('COPERNICUS/CORINE/V20/100m/2018');
print('CORINE:', corine);
Map.addLayer(corine, {}, 'CORINE');

// Get location of forest (=23-25)
//print(corine.propertyNames());
//var lc_value = corine.get('landcover_class_values');
//print(lc_value);

//Mask all layers that are not forest
var forest = corine.updateMask(corine.gte(23).and(corine.lte(25)))
print('Forest:', forest);
Map.addLayer(forest, {}, 'Forest');

but I still can't visualize the data.

Can you tell where the problem is?

I'm new to earth engine and still learning the syntax.

1

First, you may need to center the map to the area covered by the data. The data covers Europe only, so you need to center the display on a feature located in Europe. Try adding the following line like:

Map.setCenter(16.436, 39.825, 6);

For the second part where you masked a range of pixels, everything is masked because there is no pixel value between 23 and 25. According to the description of the data, the class codes (pixel values) range between 111 and 523 as described here. So, you need to choose your class of interest following the specification of the data. The forests you seem interested in are coded from 311 to 335, so your map will display if you, for instance, change 23 to 311 and 25 to 335 in your code as below.

//Mask all layers that are not forest
var forest = corine.updateMask(corine.gte(311).and(corine.lte(335)))
print('Forest:', forest);

Map.addLayer(forest, {}, 'Forest');

code link

1
  • Hi @Serenity, Did my answer helped?
    – Liman
    Sep 10 '20 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.