用GEE下载landsat8影像数据并裁剪输出

用GEE下载landsat8影像数据并裁剪输出_第1张图片

方法1

var roi=table
var roi_geometry = roi.geometry();
var roi = ee.FeatureCollection("users/2309012038/kmzcq");
Map.centerObject(roi,7);
 
var empty =ee.Image().toByte();
var outline = empty.paint({
  featureCollection:roi,
  color:0,
  width:3
});
Map.addLayer(outline, {palette: "ff0000"}, "outline");
 
var landsatCollection = ee.ImageCollection("LANDSAT/LC08/C01/T1")
                          .filterDate('2015-01-01', '2015-12-31')
                          .filterBounds(roi)
                          .filterMetadata('CLOUD_COVER_LAND', 'less_than', 10);

print('landsatCollection',landsatCollection)

// 生成无云的数据集并且合成为一副
var composite = ee.Algorithms.Landsat.simpleComposite({
                collection: landsatCollection,
                asFloat: true
});

print('composite', composite)

// 可视化合成影像
var composite = composite.clip(roi)
Map.addLayer(composite, {bands: ['B6', 'B5', 'B4'], max: 0.5, gamma: 2}, 'L8 Image', true);
// 导出导出影像 
Export.image.toDrive({
  image:composite.int16(),
  description: 'Landsat8_2015_01',
  fileNamePrefix:'Landsat8_km2015',
  region:roi,
  scale:30,
  crs: "EPSG:4326",
  maxPixels:1e13})

方法2

//首先,导入自己的研究区矢量数据
var ROI = ee.FeatureCollection("users/2309012038/whq");
var ROI = ROI.geometry();

//然后,选择数据集和合成数据的时间范围
var dataset = ee.ImageCollection('LANDSAT/LC08/C02/T1')
    .filterDate('2020-01-01', '2020-12-31').filter(ee.Filter.lt("CLOUD_COVER",5));


//用clip()函数里面的行政边界切割
var ROI_collection = ee.Algorithms.Landsat.simpleComposite(dataset).clip(ROI)

print(ROI_collection)
Map.centerObject(ROI, 7);
//显示菏泽的shp边界
Map.addLayer(ROI,{color:'yellow',fillColor: "00000000", width: 1},'Heze Boundary');

//显示ROI影像并且以321合成,后面命名
Map.addLayer(ROI_collection,{bands:["B4","B3","B2"],gamma:1.3,max:108,min:15},'Heze Image');

//下载处理好的影像
Export.image.toDrive({
  image:ROI_collection,
  description: 'Landsat8_2020',
  fileNamePrefix:'Landsat8_whq',
  region:ROI,
  scale:30,
  crs: "EPSG:4326",
  maxPixels:1e13
})

你可能感兴趣的:(javascript)