I tried to generate a chart for values of multiple points for AOD taking help of the very helpful video: https://www.youtube.com/watch?v=5bOO0PJJMf0. However, I'm unable to get GEE to recognize values of more than one point in a collection of 7.
Here's the code:
var maod = ee.ImageCollection("MODIS/006/MCD19A2_GRANULES"),
kanpur =
/* color: #70d68e */
/* shown: false */
ee.FeatureCollection(
[ee.Feature(
ee.Geometry.Polygon(
[[[78.5614794892115, 27.630292998342572],
[78.5614794892115, 25.170437036589544],
[81.840898434524, 25.170437036589544],
[81.840898434524, 27.630292998342572]]]),
{
"1": "Bound",
"system:index": "0"
})]),
MultiPointAOD = /* color: #f70000 */ee.FeatureCollection(
[ee.Feature(
ee.Geometry.Point([80.4291552704615, 26.511722460604513]),
{
"system:index": "0"
}),
ee.Feature(
ee.Geometry.Point([81.51954833686774, 27.087836554978104]),
{
"system:index": "1"
}),
ee.Feature(
ee.Geometry.Point([81.21055785835212, 25.521349742082215]),
{
"system:index": "2"
}),
ee.Feature(
ee.Geometry.Point([79.67762384859742, 25.384298993749066]),
{
"system:index": "3"
}),
ee.Feature(
ee.Geometry.Point([79.03663818061774, 26.351856976593158]),
{
"system:index": "4"
}),
ee.Feature(
ee.Geometry.Point([79.34425536811774, 27.434530441120618]),
{
"system:index": "5"
}),
ee.Feature(
ee.Geometry.Point([80.71754638374274, 27.087836405728336]),
{
"system:index": "6"
})]),
geometry =
/* color: #d63000 */
/* shown: false */
/* displayProperties: [
{
"type": "rectangle"
},
{
"type": "rectangle"
}
] */
ee.FeatureCollection(
[ee.Feature(
ee.Geometry.Polygon(
[[[78.577958981399, 27.636673418136443],
[78.577958981399, 25.181926141677547],
[81.8463915985865, 25.181926141677547],
[81.8463915985865, 27.636673418136443]]], null, false),
{
"system:index": "0"
}),
ee.Feature(
ee.Geometry.Polygon(
[[[81.84364501655524, 25.216718878626583],
[81.84364501655524, 25.14215084694132],
[81.84364501655524, 25.14215084694132],
[81.84364501655524, 25.216718878626583]]], null, false),
{
"system:index": "1"
})]);
var aod = maod
.filterDate('2019-01-01', '2019-12-31')
.map(function(image){return image.clip(kanpur)})
.select('Optical_Depth_055');
Map.centerObject(kanpur,8);
var aoc = {
min: 380,
max: 700,
palette: ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red']
};
var aodavg = aod.reduce(ee.Reducer.mean());
Map.addLayer(aodavg, aoc, "AOD Monthly Average");
var chart =
ui.Chart.image
.series({
imageCollection: aod,
region: kanpur,
reducer: ee.Reducer.mean(),
scale: 500,
// xProperty: 'system_time_start'
})
.setSeriesNames(['Aerosol Optical Depth'])
.setOptions({
title: 'AOD MODIS Time Series',
hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},
vAxis: {
title: 'AOD Value',
titleTextStyle: {italic: false, bold: true}
},
lineWidth: 5,
colors: ['e37d05'],
curveType: 'function'
});
// print(chart);
var points = ee.FeatureCollection(MultiPointAOD);
var pointsamp = points.map(function(feature){
return ee.Feature(feature.kanpur(), {'id': feature.id()});
});
var char2 = ui.Chart.image.seriesByRegion({
imageCollection: aod,
regions: pointsamp,
reducer: ee.Reducer.mean(),
}).setOptions({
interpolateNulls: true,
lineWidth: 1,
pointSize: 3,
title: 'Overtime AOD at diff hotspots',
vAxis: {title: 'AOD Value'},
hAxis: {title: 'Date', format: 'YYYY-MMMM', gridlines: {count: 12}},
colors: ['blue', 'yellow', 'red']
});
print(char2);