var roi = /* color: #00ff00 */ee.Geometry.Point([-122.10067749023438, 37.43615762405059]),
var l8sr = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR");
// ndvi函数
var addNDVI = function(image) {
var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI');
return image.addBands(ndvi);
};
// 时间筛选和映射ndvi
var withNDVI = l8sr.filterDate('2017-01-01', '2017-12-31').map(addNDVI);
// 制图表
var chart = ui.Chart.image.series({
imageCollection: withNDVI.select('NDVI'),
region: roi,
reducer: ee.Reducer.first(),
scale: 30
});
// 定义图表的自定义选项。见。
// https://developers.google.com/chart/interactive/docs/reference
var options = {
title: 'NDVI over time',
hAxis: { title: 'time' },
vAxis: { title: 'NDVI' },
series: {
0: { color: 'green' }
}
};
// 设置图表的选项并打印。
chart = chart.setOptions(options);
print(chart);
地球引擎保姆级教程——最简单的单点NDVI时序图表!
最新推荐文章于 2024-05-03 13:54:59 发布