0

I generated NDVI from different satellites individually. Is it possible to plot all these NDVI values in a single graph, by satellite type?

 var roi = ee.FeatureCollection([ ee.Feature(ee.Geometry.Point([12.487749926662959, 41.88485067969689])), ee.Feature(ee.Geometry.Point([12.492396084115729, 41.890305914470154])) ]) // Import the Landsat 8 TOA image collection//////////////////////////////////////////////////// var l8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA').filterDate('2022-10-01', '2023-07-31').filter(ee.Filter.lt('CLOUD_COVER', 10)); // Map a function over the Landsat 8 TOA collection to add an NDVI band. var withNDVI = l8.map(function(image) { var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI'); return image.addBands(ndvi); }); // Create a chart. var chart = ui.Chart.image.series({ imageCollection: withNDVI.select('NDVI'), region: roi, reducer: ee.Reducer.mean(), scale: 30 }).setOptions({lineWidth: 1, pointSize: 3, title: 'NDVI 30m Landasat-8'}); // Display the chart in the console. print(chart); // Import the S2 dataset/////////////////////////////////////////////////////////////////////// var S2 = ee.ImageCollection('COPERNICUS/S2').filterDate('2022-10-01', '2023-07-31').filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 10)) // Map a function over the Landsat 8 TOA collection to add an NDVI band. var withNDVI = S2.map(function(image) { var ndvi = image.normalizedDifference(['B8', 'B4']).rename('NDVI'); return image.addBands(ndvi); }); // Create a chart. var chart = ui.Chart.image.series({ imageCollection: withNDVI.select('NDVI'), region: roi, reducer: ee.Reducer.mean(), scale: 10 }).setOptions({lineWidth: 1, pointSize: 3, title: 'NDVI 10m Sentinel-2'}); // Display the chart in the console. print(chart); // Import the Landsat-9 dataset/////////////////////////////////////////////////////////////////////// var l9 = ee.ImageCollection('LANDSAT/LC09/C02/T1_TOA').filterDate('2022-10-01', '2023-07-31').filter(ee.Filter.lt('CLOUD_COVER', 10)); // Map a function over the Landsat 8 TOA collection to add an NDVI band. var withNDVI = l9.map(function(image) { var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI'); return image.addBands(ndvi); }); // Create a chart. var chart = ui.Chart.image.series({ imageCollection: withNDVI.select('NDVI'), region: roi, reducer: ee.Reducer.mean(), scale: 30 }).setOptions({lineWidth: 1, pointSize: 3, title: 'NDVI 30m Landasat-9'}); // Display the chart in the console. print(chart); // Import the MODIS/061/MYD09Q1 dataset/////////////////////////////////////////////////////////////////////// var My = ee.ImageCollection('MODIS/061/MYD09Q1').filterDate('2022-10-01', '2023-07-31'); // Map a function over the Landsat 8 TOA collection to add an NDVI band. var withNDVI = My.map(function(image) { var ndvi = image.normalizedDifference(['sur_refl_b02', 'sur_refl_b01']).rename('NDVI'); return image.addBands(ndvi); }); // Create a chart. var chart = ui.Chart.image.series({ imageCollection: withNDVI.select('NDVI'), region: roi, reducer: ee.Reducer.mean(), scale: 250 }).setOptions({lineWidth: 1, pointSize: 3, title: 'NDVI 250m MODIS 8 dias '}); // Display the chart in the console. print(chart); // Import the MODIS/061/MYD13Q1 dataset/////////////////////////////////////////////////////////////////////// var Mo = ee.ImageCollection('MODIS/061/MYD13Q1').filterDate('2022-10-01', '2023-07-31'); // Map a function over the Landsat 8 TOA collection to add an NDVI band. var withNDVI1 = Mo.map(function(image) { var ndvi = image.select(['NDVI']).rename('NDVI'); return image.addBands(ndvi); }); // Create a chart. var chart = ui.Chart.image.series({ imageCollection: withNDVI.select('NDVI'), region: roi, reducer: ee.Reducer.mean(), scale: 500 }).setOptions({lineWidth: 1, pointSize: 3, title: 'NDVI 500m MODIS/NOAA 16 dias'}); // Display the chart in the console. print(chart); // Import the NASA/VIIRS/002/VNP13A1 dataset/////////////////////////////////////////////////////////////////////// var Vi = ee.ImageCollection('NASA/VIIRS/002/VNP13A1').filterDate('2022-10-01', '2023-07-31'); // Map a function over the Landsat 8 TOA collection to add an NDVI band. var withNDVI2 = Vi.map(function(image) { var ndvi = image.select(['NDVI']).rename('NDVI'); return image.addBands(ndvi); }); // Create a chart. var chart = ui.Chart.image.series({ imageCollection: withNDVI.select('NDVI'), region: roi, reducer: ee.Reducer.mean(), scale: 500 }).setOptions({lineWidth: 1, pointSize: 3,title: 'NDVI 500m VIIRS 16 dias'}); // Display the chart in the console. print(chart); 
1
  • 1
    There's a lot of code, and not much indication of where you make the attempt, or of what problem results. Commented Jan 4 at 4:53

1 Answer 1

1

Merge your ImageCollections, pass that to your chart and use setSeriesNames.

var roi = ee.FeatureCollection([ ee.Feature(ee.Geometry.Point([12.487749926662959, 41.88485067969689])), ee.Feature(ee.Geometry.Point([12.492396084115729, 41.890305914470154])) ]) // Import the image collection//////////////////////////////////////////////////// var l8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA').filterDate('2022-10-01', '2023-07-31').filter(ee.Filter.lt('CLOUD_COVER', 10)); // Map a function over the collection to add an NDVI band. var NDVI_L8 = l8.map(function(image) { var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI_L8'); return image.addBands(ndvi); }); // Import the S2 dataset/////////////////////////////////////////////////////////////////////// var S2 = ee.ImageCollection('COPERNICUS/S2').filterDate('2022-10-01', '2023-07-31').filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 10)) // Map a function over the collection to add an NDVI band. var NDVI_S2 = S2.map(function(image) { var ndvi = image.normalizedDifference(['B8', 'B4']).rename('NDVI_S2'); return image.addBands(ndvi); }); // Import the Landsat-9 dataset/////////////////////////////////////////////////////////////////////// var l9 = ee.ImageCollection('LANDSAT/LC09/C02/T1_TOA').filterDate('2022-10-01', '2023-07-31').filter(ee.Filter.lt('CLOUD_COVER', 10)); // Map a function over the collection to add an NDVI band. var NDVI_L9 = l9.map(function(image) { var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI_L9'); return image.addBands(ndvi); }); // Import the MODIS/061/MYD09Q1 dataset/////////////////////////////////////////////////////////////////////// var My = ee.ImageCollection('MODIS/061/MYD09Q1').filterDate('2022-10-01', '2023-07-31'); // Map a function over the collection to add an NDVI band. var NDVI_MY = My.map(function(image) { var ndvi = image.normalizedDifference(['sur_refl_b02', 'sur_refl_b01']).rename('NDVI_MY'); return image.addBands(ndvi); }); var NDVI_ALL = NDVI_L8.select("NDVI_L8") .merge(NDVI_S2.select("NDVI_S2")) .merge(NDVI_L9.select("NDVI_L9")) .merge(NDVI_MY.select("NDVI_MY")) .filterBounds(roi); // Create a chart. var chart = ui.Chart.image.series({ imageCollection: NDVI_ALL, region: roi, reducer: ee.Reducer.mean(), scale: 500 }) .setSeriesNames([ 'NDVI (L8)', 'NDVI (S2)', 'NDVI (L9)', 'NDVI (MY)' ]) .setOptions({lineWidth: 1, pointSize: 3,title: 'NDVI'}); // Display the chart in the console. print(chart); 

enter image description here

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.