ui.Thumbnail
# ui.Thumbnail
缩略图组件。
函数 | 返回值 |
---|---|
ui.Thumbnail(image,params,style,onClick) | ui.Thumbnail |
参数 | 类型 | 说明 |
---|---|---|
image | Image|ImageCollection | 缩略图的影像或者影像集合 |
params | Object | 缩略图样式参数 |
style | Object | 组件的样式 |
onClick | Function | 点击回调方法 |
# getImage
返回加载的影像或影像集合
函数 | 返回值 |
---|---|
getImage() | Image|ImageCollection |
# getParams()
返回设置的显示样式。
函数 | 返回值 |
---|---|
getParams() | Object |
# getStyle
返回Thumbnail样式。
函数 | 返回值 |
---|---|
getStyle() | Object |
# onClick
点击缩略图回调方法。
函数 | 返回值 |
---|---|
onClick(callback) | Null |
参数 | 类型 | 说明 |
---|---|---|
callback | Function | 点击回调方法。 |
# setImage
设置影像或者影像集合。
函数 | 返回值 |
---|---|
setImage(image) | ui.Thumbnail |
参数 | 类型 | 说明 |
---|---|---|
image | Image|ImageCollection | 缩略图影像或者影像集合。 |
# setParams
设置缩略图参数样式。
函数 | 返回值 |
---|---|
setParams(params) | ui.Thumbnail |
参数 | 类型 | 说明 |
---|---|---|
params | Object | 设置缩略图参数样式。 |
# setStyle
设置Thumbnail样式
函数 | 返回值 |
---|---|
setStyle(style) | ui.Thumbnail |
参数 | 类型 | 说明 |
---|---|---|
style | Object | 缩略图样式。 |
/**
* @File : ui.Thumbnail
* @Time : 2021/3/23
* @Author : piesat
* @Version : 1.0
* @Contact : 400-890-0662
* @License : (C)Copyright 航天宏图信息技术股份有限公司
* @Desc : 缩略图组件
*/
var roi = pie.FeatureCollection('NGCC/CHINA_PROVINCE_BOUNDARY')
.filter(pie.Filter.eq("code", 110000))
.first()
.geometry();
//定位地图中心
Map.centerObject(roi, 6);
Map.addLayer(roi, { color: "red", fillColor: "00000000" }, "roi");
//通过指定区域过滤
var images = pie.ImageCollection("TPDC/CHINA_1KM_AVG_TEM_MONTH")
.filterDate("2020-01-01", "2020-12-31")
.select("B1")
.map(function (image) {
image = image.multiply(0.1);
return image.clip(roi);
});
var title = [];
for (var i=0; i<12;i++) {
title.push(`北京市2020年${i+1}月气温图`);
}
var img = ui.Thumbnail({
image: images,
params: {
min: -15,
max: 35,
palette: [
'0A21DF', '1B96FC', '32F8FC', 'CDFFFF', 'FFFAAA',
'FBFD45', 'F69369', 'EE6C6D', 'DE1418', '92070B'
],
region: roi,
dimensions: "400x350",
framesPerSecond: 2,
text: title,
textSize: "16px",
textColor: "#ffffff",
textHorizontal: "right", // 文本的水平对齐方式
textVertical: "bottom", // 文本的垂直对齐方式
}
});
有问题,我来改改 (opens new window)
上次更新: 2022/05/15, 05:29:22