GEE下载landsat数据
程序员文章站
2022-07-12 23:49:27
...
var l8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA");
var roi = ee.FeatureCollection("users/ChenLK/Beijing");
var selectCol = l8.filterBounds(roi)
.filterDate("2017-1-1", "2018-6-1")
.map(ee.Algorithms.Landsat.simpleCloudScore)
.map(function(img) {
img = img.updateMask(img.select("cloud").lt(1));
return img;
})
.sort("system:time_start");
var l8Img = selectCol.mosaic().clip(roi);
Map.addLayer(l8Img, {bands: ["B3", "B2", "B1"], min:0, max:0.3}, "l8");
Map.centerObject(roi, 8);
Map.addLayer(roi, {color: "red"}, "roi");
// // To Drive
// //导出文件到Drive,名称为l8Img,分辨率30米,区域是roi区域
// Export.image.toDrive({
// image: l8Img.select(["B3", "B2", "B1"]),
// description: "Drive-l8ImageDrive",
// fileNamePrefix: "l8Img1",
// folder: "training01",
// scale: 30,
// region: roi.geometry(),
// crs: "EPSG:4326",
// maxPixels: 1e13
// });
//Landsat8 all bands loop to Drive
var bands = l8Img.bandNames().getInfo();
for (var i=0; i<l8Img.bandNames().size().getInfo();i++){
print(bands[i]);
Export.image.toDrive({
image: l8Img.select(bands[i]),
fileNamePrefix: "Landsat8_"+bands[i],
folder:"training01" ,
scale:30,
description: "Landsat8_"+bands[i],
maxPixels:1e13,
region:roi.geometry().bounds()
});
}
下一篇: Win10右键添加notepad++