0

I extracted pixel values at given points in the Google Earth Engine from the vegetation cover data set MOD44B.006:

https://developers.google.com/earth-engine/datasets/catalog/MODIS_006_MOD44B#description

That is the code I used:

// Load Data 
var dataset = ee.ImageCollection('MODIS/006/MOD44B');

var visualization = {
  bands: ['Percent_Tree_Cover'],
  min: 0,
  max: 100,
  palette: ['bbe029', '0a9501', '074b03']
};

Map.centerObject(dataset);

Map.addLayer(dataset, visualization, 'Percent Tree Cover');

var image = dataset.first();

// Extracting values 
var sampled_points = image.sampleRegions({ 
  collection: points, 
  scale: 30, // pixel resolution in meters 
  geometries: true // if ‘true’, the point coordinates will be added to the output
});

print(sampled_points, 'Percent_Tree_Cover');

// Drawing chart to download CSV values 
print(ui.Chart.feature.byFeature({ 
  features: sampled_points, 
  yProperties: ['Percent_Tree_Cover']
}));

Map.centerObject(sampled_points, 3); 
Map.addLayer(sampled_points, {color: 'blue'}, 'sampled');

// Exporting features, specifying corresponding names 
Export.table.toDrive(sampled_points, 
"sampled_points", //my task
"GEE_Folder", //my export folder in Google Drive 
"vegetation_cover", //file name 
"CSV");

On the GEE Website (link above) it says, that the data has an availability from 2000-03-05T00:00:00Z – 2020-03-05T00:00:00.

How do I know from what sensing period within these 20 years my extraced data is and how can I define in the code, from what time period or year I want it to extract the pixel values at my points?

I need the most current I can get.

I am pretty new to GEE.

1 Answer 1

3

You can filter your entire MODIS image collection modifying the following line:

var dataset = ee.ImageCollection('MODIS/006/MOD44B')
                .filterDate('2000-03-05', '2000-10-05');

The ee.ImageCollection.filterDate function allows to filter the image collection by a date range.

Then you can print your MODIS image collection using:

print(dataset)

and explore the properties of your images. One of these properties will contain the date of acquisition or date of composition. I believe in your collection it is in the date_range property, in UnixTime.

https://code.earthengine.google.com/ec5501c02d31f49c46cd06a15ec60a83

0

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.