[GIS] Temporal segmentation algorithms using Google Earth Engine

change detectiongoogle-earth-engine

I'm using the temporal segmentation algorithm Vegetation Regeneration and Disturbance Estimates – Verdet – for land cover change detection. The output layer is created but I can't display or export it (GEE returns processing errors). Does anyone know how can I work with this tool?

// NDVI image collection from Landsat TM
var collection5 = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR')
    .filter(ee.Filter.eq('WRS_PATH', 219))
    .filter(ee.Filter.eq('WRS_ROW', 72))
    .filterDate('2008-01-01', '2011-12-31')
    .filterMetadata('CLOUD_COVER', 'equals', 0);

  var segIndex = function(img){
      var index = img.normalizedDifference(['B4', 'B5']);
      return index;
  };
  var collection5 = collection5.map(segIndex);

// NDVI image collection from Landsat OLI
var collection8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
    .filter(ee.Filter.eq('WRS_PATH', 219))
    .filter(ee.Filter.eq('WRS_ROW', 72))
    .filterDate('2013-01-01', '2017-12-31')
    .filterMetadata('CLOUD_COVER', 'equals', 0);

  var collection8 = collection8.map(segIndex);

// Merge collections
var merge = ee.ImageCollection(collection5.merge(collection8));

// Run VerDET
var verdet = ee.Algorithms.TemporalSegmentation.Verdet(merge);

Best Answer

The primary issue is that you're calculating NDVI incorrectly. The NDVI bands for Landsat 8 are B5 and B4; the NDVI bands for Landsat 5 are B4 and B3. In Earth Engine, the .normalizedDifference method subtracts the second band from the first band and divides the result by the sum of the two bands. You've provided the arguments as .normalizedDifference('B4', 'B5') instead of .normalizedDifference('B5', 'B4'). As a result, all of your NDVI scores are negative and the VerDET output is nonsensical. So for Landsat 8, you'd want something like:

// NDVI image collection from Landsat OLI
var collection8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
    .filter(ee.Filter.eq('WRS_PATH', 219))
    .filter(ee.Filter.eq('WRS_ROW', 72))
    .filterDate('2013-01-01', '2017-12-31')
    .filterMetadata('CLOUD_COVER', 'equals', 0)
    .map(function(image) {
        return image.normalizedDifference(['B5', 'B4'])
    });

The other issue is the source of the internal server error. The exact cause of this is not clear, but it's probably due an out-of-memory error. You'll notice that some tiles finish, while other tiles do not. It appears that the edge tiles, with less imagery in them, are completing, which suggests that its a memory error. Furthermore, it seems like the algorithm is able to complete only when running on fewer images. You might try running the code on a collection of annual composites to reduce the number of images that its running on, but the solution is primarily going to have to come from Google; it seems like sometimes this works and sometimes it doesn't.

The following code runs the VerDET analysis on Landsat 8 only: https://code.earthengine.google.com/25b7db815d4f9c40e56b145b340f4de8