My aim is to combine several Sentinel-2 Level2A images of the same location/orbit number but at different dates of a year.

enter image description here

I would like to have different options to create that mosaicing (e.g., if multiple data per pixel is available than create mean/median/std etc., if no data is available than keep Nodata, of only one dataset has data than keep them).

Is there any tool in ENVI which can be used for such mosaicing processes?

3 Answers 3


You can use "Layer stacking" in the menu "Basic Tools" from the classic ENVI GUI.

  • thanks, but it is not exactly what I like to do. I do not find options in the "layer Stacking" tool for combining the layers according to any given combination rule (mean, median, etc) if you have multiple information for the same pixel.
    – xmisx
    Jul 4, 2019 at 12:28

Its called Stacking not Mosaicing. I dont know about ENVI but you can do so on GEE(Google Earth Engine https://code.earthengine.google.com/ ) Use the following code:

//Study area
var studyArea = ee.Geometry.Polygon(
        [[[73.1695278540229, 22.32392930639361],
          [73.1695278540229, 22.301378515992305],
          [73.19682201295845, 22.301378515992305],
          [73.19682201295845, 22.32392930639361]]], null, false);
Map.setCenter(73.17983, 22.31218, 15)
var imageCollection = ee.ImageCollection('COPERNICUS/S2_SR').filterBounds(studyArea);
function maskS2clouds(imageCollection) {
  var qa = imageCollection.select('QA60');
  // Bits 10 and 11 are clouds and cirrus, respectively.
  var cloudBitMask = 1 << 10;
  var cirrusBitMask = 1 << 11;

  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudBitMask).eq(0).and(qa.bitwiseAnd(cirrusBitMask).eq(0));

  return imageCollection.updateMask(mask).divide(10000).select('B2', 'B3','B4', 'B8', 'B11', 'B12').copyProperties(imageCollection, ["system:time_start"]);

// Range of Year
var stepList = ee.List.sequence(2018,2018);

var filterCollection = stepList.map(function(year){
  var startDate = ee.Date.fromYMD(year,1,1); //Start Date
  var endDate = ee.Date.fromYMD(year,12,31); //End Date
  var composite_i = imageCollection.filterDate(startDate, endDate)
                        .median() //.mean(), .mode(), .max(), .min()
  return composite_i;

var yearlyComposites = ee.ImageCollection(filterCollection);
print(yearlyComposites, 'Composites');

// Export the image, specifying scale and region.
  image: yearlyComposites,
  description: 'yearlyComposites',
  scale: 10,
  folder: 'GEE',
  region: studyArea

Just change the study area, start date and end date. And change the median to mean or any of the options stated above.


If I understand your question correctly, your tasks can be completed using either the QGIS Raster Calculator or the Arc Raster Calculator, with the resulting output sent to a new raster file.

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.