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}
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)