Here is a basic example using data from the VIIRS collection:

var dataset = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG')
                  .filter(ee.Filter.date('2017-05-01', '2017-07-31'));
var nighttime = dataset.select('avg_rad');
var nighttimeVis = {min: 0.0, max: 60.0};
Map.setCenter(-77.1056, 38.8904, 8);
Map.addLayer(nighttime, nighttimeVis, 'Nighttime');

Because of the date range being passed to the ee.Filter.date() function along with the fact that the VIIRS collection consists of monthly average radiance composite images, the resulting dataset variable will include a list of 3 separate images from the overall collection: '2017-05-01', '2017-06-01', and '2017-07-01'.

enter image description here

When the 'avg_rad' band is selected and then plotted as a single layer, we see that the resulting layer is a greyscale band:

enter image description here

I'm wondering how the Map.addLayer() function resolves the fact that it is using values from 3 different images to create a single band for the resulting layer? For each pixel of the new layer, does it take the mean of the corresponding pixels from each Image i.e. new_pixel_value = (px1 + px2 + px3)/image_count? Or is there some other process going on?

1 Answer 1


I actually figured this out after looking through the example code associated with the Map.addLayer documentation.

From the a comment within the sample code: "Images within ImageCollections are automatically mosaicked according to mask status and image order. The last image in the collection takes priority, invalid pixels are filled by valid pixels in preceding images."

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.