1

GEE has the full National Land Cover Database and this has enabled a number of projects for me but I'm stumbling on a simple problem.

When I display the NLCD I can see that each point contains land cover values of all four epochs (1992, 2001, 2006 and 2011) but I'm not sure how to display them. As of now I basically just have the default display code but I'd like to show both 2011 and 2006.

var dataset = ee.ImageCollection('USGS/NLCD');
var landcover = dataset.select('landcover');
var landcoverVis = {
  min: 11.0,
  max: 95.0,
  palette: [
    '5475A8', 'ffffff', 'E8D1D1', 'E29E8C', 'ff0000', 'B50000', 'D2CDC0',
    '85C77E', '38814E', 'D4E7B0', 'AF963C', 'DCCA8F', 'FDE9AA', 'D1D182',
    'A3CC51', '82BA9E', 'FBF65D', 'CA9146', 'C8E6F8', '64B3D5'
  ],
};
Map.setCenter(-76.356, 35.286, 8);
Map.addLayer(landcover, landcoverVis, 'Landcover');
1

To add them all to the map, you can filter them for example by their system:index property and add them individually as images to the map.

// load the four maps based on their year
var years = ['1992','2001', '2006', '2011'];

Map.setCenter(-76.356, 35.286, 8);
for (var i = 0; i < years.length; i++) {
  var year = years[i];
  var nameImage = 'NLCD' + year;

  Map.addLayer(landcover.filter(ee.Filter.eq('system:index', nameImage)).first(), landcoverVis, 'Landcover: '+year);
}

You could also write down the filter four times with the name of the image ID written for each element, off course.

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.