Google Earth Engine(GEE)—geemap无云影像合成案例分析Cloud free composite

2024-02-02 08:31:33 浏览数 (1)

代码语言:javascript复制
import ee
import geemap

Map = geemap.Map()
Map

states = ee.FeatureCollection('TIGER/2018/States')
TN = states.filter(ee.Filter.eq("NAME", "Tennessee"))
Map.addLayer(TN, {}, "Tennessee")
years = ee.List.sequence(2013, 2020)
years.getInfo()

def yearly_image(year):
    
    start_date = ee.Date.fromYMD(year, 1, 1) 
    end_date = start_date.advance(1, "year")
    
    collection = ee.ImageCollection('LANDSAT/LC08/C01/T1') 
        .filterDate(start_date, end_date) 
        .filterBounds(TN) 
    #这里用到了一个简单合成和裁剪矢量集合的操作,因为都是对集合所以函数有些变化
    image =  ee.Algorithms.Landsat.simpleComposite(collection).clipToCollection(TN)

    return image

images = years.map(yearly_image)
vis_params = {'bands': ['B5',  'B4',  'B3'], 'max': 128}
#上面是进行了一年的操作,下面这个就是分别计算每一遍的,通过时间遍历i每一年的影像然后加载到图层!
for index in range(0, 8):
    image = ee.Image(images.get(index))
    layer_name = "Image "   str(index   2013)
    Map.addLayer(image, vis_params, layer_name)

0 人点赞