【18.PIE-Engine案例—— 中国植被变化动画】
中国植被变化动画
原始路径
最终结果
具体代码
/**
* @File : PIEChinaNDVISeries
* @Time : 2022/2/10
* @Author : piesat
* @Version : 1.0
* @Contact : 400-890-0662
* @License : (C)Copyright 航天宏图信息技术股份有限公司
* @Desc : 中国植被变化动画
*/
//加载中国边界图
var global = pie.FeatureCollection("RESDC/WORLD_COUNTRY_BOUNDARY");
var chngeometry = global.filter(pie.Filter.eq("fcname", "中国"));
var china = chngeometry.getAt(0).geometry();
//中国九段线
var nine = pie.FeatureCollection("user/pieadmin/public/shape/10_line_dash");
Map.addLayer(china, {color:"ff0000", fillColor:"00000000"}, "china");
Map.addLayer(nine, {color: "ff0000", fillColor: "00000000"}, "nine");
var vis = {
min: 0,
max: 1,
palette: 'CA7A41, CE7E45, DF923D, F1B555, FCD163, 99B718, '+
'74A901, 66A000, 529400,3E8601, 207401, 056201, 004C00,'+
'023B01, 012E01, 011D01, 011301'
};
function getNDVI(year) {
var image = pie.ImageCollection("EMDO/CHINA_MONTH_NDVI")
.filterDate(year + "-5-1", year + "-9-1")
.select("mean")
.mean()
.clip(china)
.multiply(0.0001);
return image;
}
var layers = [];
for (var year=2002; year<=2020; year++) {
var image = getNDVI(year);
layers.push({
layer: image,
name: year.toString(),
style: vis
})
}
var label = ui.Label("")
label = label.setStyle({
backgroundColor: "white"
})
Map.addUI(label);
//动画显示
Map.playLayersAnimation(layers, 2, -1, function(name, index) {
label = label.setValue("中国植被变化:"+name+"年");
});
原文地址:https://blog.csdn.net/qq_36253366/article/details/143056335
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!