I try to find bare soil areas. Those which are bare over the whole year and those which are fresh harvest and remain bare over a certain time. I try to do this with sentinel-2 data. But the Problem is that the cloud cover does not allow a sufficient detection. What kind of Satellite Products and/or Indices can help me out with this problem. Can anyone give me a hint in which direction I have to look?

3 Answers 3


You may want to try spectral unmixing. Here's an example to get you started link to script:

// Function to mask clouds using the Sentinel-2 QA band.
function maskS2clouds(image) {
  var qa = image.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(

  // Return the masked and scaled data, without the QA bands.
  return image.updateMask(mask).divide(10000)
      .copyProperties(image, ["system:time_start"])

// Map the function over one year of data and take the median.
// Load Sentinel-2 TOA reflectance data.
var collection = ee.ImageCollection('COPERNICUS/S2')
    .filterDate('2016-01-01', '2016-12-31')
    // Pre-filter to get less cloudy granules.
    .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))

// First, let's find a cloud free scene in our area of interest.
var image = collection.median()

// Use the reflective bands.
var bands = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9'];

// Now, delineate polygons of 'pure' regions.  Click +New Layer for 
// each polygon.  Name the imports 'bare', 'vegetation' and 'water'.
// Get the mean spectrum in each of the endmember polygons.
var bareMean = image.reduceRegion(ee.Reducer.mean(), bare, 30).values(bands);
var waterMean = image.reduceRegion(ee.Reducer.mean(), water, 30).values(bands);
var vegMean = image.reduceRegion(ee.Reducer.mean(), vegetation, 30).values(bands);

// Constrained:
var constrained = image.select(bands).unmix([bareMean, vegMean, waterMean], true, true);
  • That's an interesting thing ;) Thanks for that! Two questions: 1) How much is a good amount of sample data? Is it better to have only one polygon like in the example above or is it better to have much training data as possible? 2) in the example above all bands will be used, but what is when a few of the bands have not a clearly different spectra. Is it better to exclude this bands? Commented Mar 9, 2019 at 12:14

Sentinel-2 is best for this, stick at it. You need to use multiple scenes and periods to get around the cloud cover. Landsat, Spot, Aster still all have clouds. Basically, clouds exist so you must overcome them.

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.