2

Trying to compute chart for NDWI

var dataset = ee.ImageCollection('LANDSAT/LE07/C01/T1_8DAY_NDWI')
                      .filterDate('1999-01-01', '2002-12-31')
                      .filterBounds(mumbai);
    var colorized = dataset.select('NDWI');
    var colorizedVis = {
      min: 0.0,
      max: 1.0,
      palette: ['0000ff', '00ffff', 'ffff00', 'ff0000', 'ffffff'],
    };
    Map.setCenter(72.88, 19.154, 10);
    Map.addLayer(colorized, colorizedVis, 'Colorized');
    print(ui.Chart.image.series(colorized, mumbai));

Error:

Error generating chart: Error in map(ID=19990525):
Image.reduceRegion: The default WGS84 projection is invalid for aggregations. Specify a scale or crs & crs_transform.
3

The imagery in your collection have originally had different projections, because it is built from Landsat scenes of different WRS paths/rows. Subsequently, you will need to provide a scale in the arguments of the ui.Chart function to tell GEE specifically how you want to aggregate pixels within the geometry. Use for example a scale of 30 (in meters), which is the nominal scale of Landsat imagery.

ui.Chart.image.series({
  imageCollection: colorized, 
  region: mumbai, 
  reducer: ee.Reducer.mean(), // default 
  scale: 30, // nominal scale Landsat imagery 
  xProperty: 'system:time_start' // default
}));

Link with random geometry as that was not provided.

| improve this answer | |
  • thanx if i increase the scale will it effect the data accuracy? – Apoorv Mamgain Jan 29 at 6:48
  • 1
    Yes it will: link – Kuik Jan 29 at 19:29

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.