I am trying to calculate the water area of Dead Sea over time. The first experiment that I did was to visualize the "Water" from the "Label" band provided by Dynamic World:

var startDate = '2019-01-21';
var endDate = '2022-01-05';

var dw = ee.ImageCollection('GOOGLE/DYNAMICWORLD/V1')
               .filterDate(startDate, endDate)
Map.centerObject(geometry, 12);

var classification = dw.select('label');

Map.addLayer(classification.first().clip(geometry).eq(0), {}, 'first of classification');

But yet, when I drew a rectangle around the Dead Sea, only the lower half is pixelated:

enter image description here

I have tried some other water body, it worked better, but still missing some corners:

enter image description here

So how can I please get the water label over all the water surface?

1 Answer 1


No, it is not incomplete. In your dates range there are probably about 3,900,000 images and you selected a little portion of the dynamic change: only the first image. Following script considers a geometry in your Dead Sea area. First of all, it prints the number of images for the first month in your dates range. There are 108,437 images.

var geometry = ee.Geometry.Polygon(
        [[[35.08223965969702, 31.882488737725048],
          [35.08223965969702, 30.737384136692008],
          [35.91170743313452, 30.737384136692008],
          [35.91170743313452, 31.882488737725048]]], null, false);

var startDate = '2019-01-01';
var endDate = '2019-02-01';

var dw_month = ee.ImageCollection('GOOGLE/DYNAMICWORLD/V1')
               .filterDate(startDate, endDate);

print("dw_month count", dw_month.size());

var startDate = '2019-01-01';
var endDate = '2022-01-01';

var dw = ee.ImageCollection('GOOGLE/DYNAMICWORLD/V1')
               .filterDate(startDate, endDate);

var classification = dw.select('water');

var nMonths = ee.Number(ee.Date(endDate).difference(ee.Date(startDate),'month')).round();
var byMonth = ee.ImageCollection(
  ee.List.sequence(0,nMonths).map(function (n) {
    var ini = ee.Date(startDate).advance(n,'month');
    var end = ini.advance(1,'month');
    return classification.filterDate(ini,end)
                  .set('system:time_start', ini);

var byMonth_lst = byMonth.toList(byMonth.size());


Map.addLayer(ee.Image(byMonth_lst.get(0)).clip(geometry), {}, 'first of classification');
// Visualization parameters.
var args = {
  crs: 'EPSG:4326',  
  dimensions: '500',
  region: geometry,
  framesPerSecond: 1

var text = require('users/gena/packages:text'); // Import gena's package which allows text overlay on image

var annotations = [
  {position: 'left', offset: '1%', margin: '1%', property: 'label', scale: 500}
function addText(image){
  var timeStamp = ee.Date(image.get('system:time_start')).format().slice(0,10); // get the time stamp of each frame. This can be any string. Date, Years, Hours, etc.
  timeStamp = ee.String('Date: ').cat(ee.String(timeStamp)); //convert time stamp to string 
  image = image.visualize({ //convert each frame to RGB image explicitly since it is a 1 band image
      forceRgbOutput: true,
      min: 0,
      max: 1,
      palette: ['midnightblue', 'blue', 'mediumblue', 'aqua', 'lime', 'limegreen', 'yellow','sandybrown', 'orange', 'crimson']
    }).set({'label':timeStamp}); // set a property called label for each image
  var annotated = text.annotateImage(image, {}, geometry, annotations); // create a new image with the label overlayed using gena's package

  return annotated;

var collection = byMonth.map(addText) //add time stamp to all images


As the number of images is so elevated, above script produces a mean image (by using "water" band; not "label" band) for each month in your dates range. It can be visualized in Map Canvas of GEE varying the integer number in following parameter byMonth_lst.get(0) (you can also use a function for loading all images at once).

However, the best way to display everything at once is by using an ui.Thumbnail object. The water area of Dead Sea over time, each month, it can be appreciated in following picture; where date associated with the monthly mean image, inside red rectangle, changes with the next image one frame per second.

enter image description here

  • In the thumbnail, does the color intensity represent the classification probability of "water"? When I reduced the palette to only two colors, I could still see different shades. Does it mean that thumbnail interpolate the colors for values between 0 and 1?
    – dgg32
    Jul 8, 2022 at 3:13
  • Just to make sure I understand it correctly, you mean DW has the all the classifications. But because the image collection I requested was too large, EE did not display them all, like the upper half of Dead Sea in my case?
    – dgg32
    Jul 8, 2022 at 3:22
  • Yes. By the way, I took the monthly mean for getting quick results. However, you can mosaic images by day for obtaining only 0 and 1 values and, probably, a better result with a reduced palette to only two colors.
    – xunilk
    Jul 8, 2022 at 12:16
  • And the "no show" question please? Because of too many images, the upper half of Dead Sea did not show classification? Thanks.
    – dgg32
    Jul 9, 2022 at 8:16

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.