0

ENgine

Any ideas on how to select image properties: In this instance, I want to mask all crop types except for Rice.

var dataset = ee.ImageCollection('USDA/NASS/CDL')
              .filter(ee.Filter.date('2017-01-01', '2018-12-31'))
              .first();
var img_cropLC = dataset.select('cropland');
Map.setCenter(-100.55, 40.71, 4);
Map.addLayer(img_cropLC, {}, 'Crop Landcover');

print(img_cropLC)

var img_cropRice = img_cropLC.properties.cropland_class_names.select('Rice') 

The last line is incorrect but I am looking for how to navigate into properties -> cropland_class_names -> and the select 'Rice'

1

1 Answer 1

2

You may be looking for this.

var img_cropRice = ee.List(img_cropLC.get('cropland_class_names'))

// knowing rice is at the third position:
var rice = img_cropRice.get(3);

Link

1
  • Thanks for this. Yep, I was initially looking at how to select rice. But my overall objective was just to load only load the rice data and mask everything else. (I made another stack exchange post and figured how to do it based on the responses !) gis.stackexchange.com/questions/338475/…
    – user144483
    Commented Oct 14, 2019 at 5:19

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.