I want to define coverage of each land cover type in my study area in Turkey-Isparta. I call ("COPERNICUS/CORINE/V20/100m/2018") dataset and restrict it for my region as below (I load Rectangle as shapefile to my assets):

var CLC= ee.Image('COPERNICUS/CORINE/V20/100m/');
var CLC2018= ee.Image('COPERNICUS/CORINE/V20/100m/2018');

var landCover2018 = CLC2018.select('landcover').clip(Rectangle);

I want to restrict the landcover dataset to my study area and get coverage of each class in this region.

My code define the coverage of each class in study area but I can't access the definition of each code for landcover types. For example as the code give me, the class with code 112 has coverage of 56591.51 km2

My code is as follows:

//var CLC2018= ee.Image('COPERNICUS/CORINE/V20/100m/2018');// converted to an import recors

var landCover2018 = CLC2018.select('landcover').clip(Rectangle);
print('Year Coverage:',CLC.size());

print('LC_Area',LC_Area);// result is 30030856907292.477
var LC2018_Area=landCover2018.geometry().area();
print('LC2018_Area',LC2018_Area);// result is Infinity
var LC_AreaSqKm = ee.Number(LC_Area).divide(1e6).round()
print('LC_AreaSqKm',LC_AreaSqKm)// result is 30030857

As below I calculate the coverage of each landcover class in study region:

var counts=landCover2018.reduceRegion({
  reducer: ee.Reducer.frequencyHistogram(),
  geometry: Rectangle,
  scale: 10

If I use CLC2018 besides the landCover2018 the result does not differ. and I print results by following command:

var LC_Counts=counts.get('landcover');
print ('LC_Counts',LC_Counts)


print('LC_Counts:', counts.get('landcover').getInfo())

This results coverage of classes as follows:

Object (17 properties)
112: 56591.51764705882
121: 4600
131: 46174.70980392157
211: 71061.55686274508
222: 230049.0823529411
231: 35600
242: 272844.474509804
243: 212301.61960784308

but I can't access the description of these landcover types as provided in 'landcover_class_names' of the 'Image COPERNICUS/CORINE/V20/100m/2018 (1 band)'

How can I get data descriptions for each class like this:

[112]: Agricultural areas; arable land; non-irrigated arable land

In brief, I want to define coverage of each landcover types in the study region with access to landcover class descriptions.

here is the whole code


1 Answer 1


As your code link does not work, I assumed an arbitrary area for Rectangle geometry. So, you can use following code for obtaining coverage of each land cover types in the study region with access to land cover class descriptions. It looks as follows:

var Rectangle = ee.Geometry.Polygon(
       [[[6.776765922231265, 47.80202894259937],
          [6.776765922231265, 47.76142608657793],
          [6.875642875356265, 47.76142608657793],
          [6.875642875356265, 47.80202894259937]]], null, false);

var CLC2018 = ee.Image('COPERNICUS/CORINE/V20/100m/2018');

var lc_values = CLC2018.get('landcover_class_values');

var lc_values = ee.List(lc_values).map(function (ele) {
  return ee.String(ee.Number(ele).int());

//print("lc_values", lc_values);

var lc_names = CLC2018.get('landcover_class_names');

//print("lc_names", lc_names);

var dict = ee.Dictionary.fromLists(lc_values, lc_names);


var landCover2018 = CLC2018.select('landcover').clip(Rectangle);



var counts = landCover2018.reduceRegion({
  reducer: ee.Reducer.frequencyHistogram(),
  geometry: Rectangle,
  scale: 10

var counts_keys = ee.Dictionary(counts).keys();
var counts_values = ee.Dictionary(counts).values();

var new_counts_keys = counts_keys.map(function(ele) {
  return dict.get(ele);


var new_dict = ee.Dictionary.fromLists(new_counts_keys, counts_values);


After running it in GEE code editor, it can be observed in following image that land cover description was paired with its respective area and printed in Console Tab as expected.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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