# !pip install geemap
import os
import ee
import geemap
Map = geemap.Map()
Map
加载 NLCD 数据
NLCD: USGS National Land Cover Database
https://developers.google.com/earth-engine/datasets/catalog/USGS_NLCD_RELEASES_2016_REL
#影像栅格数据
dataset = ee.Image('USGS/NLCD/NLCD2016')
landcover = ee.Image(dataset.select('landcover'))
Map.addLayer(landcover, {}, 'NLCD 2016')
#矢量数据,研究区选择
states = ee.FeatureCollection("TIGER/2018/States")
Map.addLayer(states, {}, 'US States')
Map.add_legend(builtin_legend='NLCD')
计算美国的地表覆盖合成
out_dir = os.path.expanduser('~/Downloads')
if not os.path.exists(out_dir):
os.makedirs(out_dir