0

I have defined a specific area to look at but now I want to only read the data for the water.

MCD12Q1.006 MODIS Land Cover Type Yearly Global 500m has a LC_Type1 Class Table and I only want to read value 17 because it has the water. How can I do this?

var Landcover = ee.ImageCollection("MODIS/006/MCD12Q1"); //terra
  var collectionTerra = Landcover
  .filterBounds(Lake_Sup)
  .filterDate('2014-07-01', '2014-08-31');

  var clip1 = function(images) {
    return images.clip(LakeSP);
  }
  • Can you post a more complete script? Is clip1 supposed to do something? It's never called. – phloem Jul 9 '19 at 19:57
2

I'm not exactly sure what you're looking for, but if it is to pare down the landcover layer to only water/not water, then you can do something like the following, which selects only the LC_Type1 band, loops through each image in the image collection and creates a boolean output for whether or not the band value equals 17.

var Landcover = ee.ImageCollection("MODIS/006/MCD12Q1");
var collectionTerra = Landcover
.filterBounds(geometry)
.filterDate('2010-07-01', '2014-08-31')
.select(['LC_Type1'])
.map(function(image) {
  return image.eq(17)
});

Map.addLayer(collectionTerra)

enter image description here

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.