用可视化参数导出图像集合的每个图像

问题描述 投票:1回答:1

我想将特定图像导出为Geotiff,以上传到QGIS上进行分析(以查看随时间变化的情况)。

我希望能够导出带有真实色带的l8_merge集合中的每个图像。

我从2019年的一张图片开始。

// l8 collection

// L8 T1, 225:58
var l8_t1_225_58 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA")
        .filter(ee.Filter.eq('WRS_PATH', 225))
        .filter(ee.Filter.eq('WRS_ROW', 58))

        .select(['B4', 'B3', 'B2', ],['B3', 'B2','B1'])
        .filter(ee.Filter.inList('LANDSAT_PRODUCT_ID',ee.List(
          ['LC08_L1TP_225058_20130911_20170502_01_T1', 
          'LC08_L1TP_225058_20140914_20170419_01_T1',
          'LC08_L1TP_225058_20150917_20170404_01_T1',
          'LC08_L1TP_225058_20170922_20171012_01_T1',
          'LC08_L1TP_225058_20181011_20181030_01_T1',
          'LC08_L1TP_225058_20191014_20191029_01_T1'
          ])));

// L8 T2, 225:58
var l8_t2_225_58 = ee.ImageCollection("LANDSAT/LC08/C01/T2_TOA")
        .filter(ee.Filter.eq('WRS_PATH', 225))
        .filter(ee.Filter.eq('WRS_ROW', 58))

        .select(['B4', 'B3', 'B2', ],['B3', 'B2','B1'])
        .filter(ee.Filter.inList('LANDSAT_PRODUCT_ID',ee.List(
          ['LC08_L1TP_225058_20130826_20170502_01_T2', 
         'LC08_L1GT_225058_20130810_20170503_01_T2',
         'LC08_L1TP_225058_20140813_20170420_01_T2',
         'LC08_L1TP_225058_20140829_20170420_01_T2',
         'LC08_L1TP_225058_20151019_20170403_01_T2',
         'LC08_L1TP_225058_20150901_20170404_01_T2',
         'LC08_L1TP_225058_20161021_20170319_01_T2',
         'LC08_L1TP_225058_20161106_20170318_01_T2',
         'LC08_L1TP_225058_20160919_20180528_01_T2',
         'LC08_L1TP_225058_20171109_20171121_01_T2',
         'LC08_L1TP_225058_20171008_20171023_01_T2',
         'LC08_L1TP_225058_20180925_20180929_01_T2',
         'LC08_L1TP_225058_20181027_20181115_01_T2',
         'LC08_L1GT_225058_20191030_20191114_01_T2',
         'LC08_L1GT_225058_20190928_20191017_01_T2'
          ])));

// L8 T1, 225:59
var l8_t1_225_59 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA")
        .filter(ee.Filter.eq('WRS_PATH', 225))
        .filter(ee.Filter.eq('WRS_ROW', 59))

        .select(['B4', 'B3', 'B2', ],['B3', 'B2','B1'])
        .filter(ee.Filter.inList('LANDSAT_PRODUCT_ID',ee.List(
          ['LC08_L1TP_225059_20140813_20170420_01_T1', 
          'LC08_L1TP_225059_20140829_20170420_01_T1',
          'LC08_L1TP_225059_20150901_20170404_01_T1',
          'LC08_L1TP_225059_20150917_20170404_01_T1',
          'LC08_L1TP_225059_20160818_20170322_01_T1',
          'LC08_L1TP_225059_20160903_20170321_01_T1',
          'LC08_L1TP_225059_20160919_20180528_01_T1',
          'LC08_L1TP_225059_20170821_20170911_01_T1',
          'LC08_L1TP_225059_20170922_20171012_01_T1',
          'LC08_L1TP_225059_20180925_20180929_01_T1',
          'LC08_L1TP_225059_20180824_20180829_01_T1',
          'LC08_L1TP_225059_20190912_20190917_01_T1',
          'LC08_L1TP_225059_20191014_20191029_01_T1'
          ])));          

 // L8 T2, 225:59
var l8_t2_225_59 = ee.ImageCollection("LANDSAT/LC08/C01/T2_TOA")
        .filter(ee.Filter.eq('WRS_PATH', 225))
        .filter(ee.Filter.eq('WRS_ROW', 59))

        .select(['B4', 'B3', 'B2', ],['B3', 'B2','B1'])
        .filter(ee.Filter.inList('LANDSAT_PRODUCT_ID',ee.List(
          ['LC08_L1GT_225059_20130810_20170503_01_T2', 
          'LC08_L1TP_225059_20131114_20170428_01_T2',
          'LC08_L1TP_225059_20131130_20170428_01_T2',
          'LC08_L1TP_225059_20150816_20170406_01_T2',
          'LC08_L1TP_225059_20170805_20170812_01_T2',
          'LC08_L1TP_225059_20181011_20181030_01_T2',
          'LC08_L1TP_225059_20190827_20190903_01_T2'
          ])));    

// L8 T1, 226:57
var l8_t1_226_57 = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA")
        .filter(ee.Filter.eq('WRS_PATH', 226))
        .filter(ee.Filter.eq('WRS_ROW', 57))

        .select(['B4', 'B3', 'B2', ],['B3', 'B2','B1'])
        .filter(ee.Filter.inList('LANDSAT_PRODUCT_ID',ee.List(
          ['LC08_L1TP_226057_20180916_20180928_01_T1',
          'LC08_L1TP_226057_20190903_20190916_01_T1'
          ]))); 

// L8 T2, 226:57
var l8_t2_226_57 = ee.ImageCollection("LANDSAT/LC08/C01/T2_TOA")
        .filter(ee.Filter.eq('WRS_PATH', 226))
        .filter(ee.Filter.eq('WRS_ROW', 57))

        .select(['B4', 'B3', 'B2', ],['B3', 'B2','B1'])
        .filter(ee.Filter.inList('LANDSAT_PRODUCT_ID',ee.List(
          ['LC08_L1GT_226057_20130801_20170503_01_T2', 
          'LC08_L1TP_226057_20140804_20170420_01_T2',
          'LC08_L1GT_226057_20150807_20180528_01_T2',
          'LC08_L1GT_226057_20150823_20170405_01_T2',
          'LC08_L1GT_226057_20160910_20170321_01_T2',
          'LC08_L1GT_226057_20160809_20170322_01_T2',
          'LC08_L1GT_226057_20160825_20180528_01_T2',
          'LC08_L1GT_226057_20170812_20170824_01_T2',
          'LC08_L1GT_226057_20170828_20170914_01_T2',
          'LC08_L1GT_226057_20170913_20170928_01_T2',
          'LC08_L1GT_226057_20180831_20180912_01_T2',
          'LC08_L1GT_226057_20181002_20181010_01_T2',
          'LC08_L1TP_226057_20191005_20191018_01_T2',
          'LC08_L1GT_226057_20190919_20190926_01_T2',
          ])));

// L8 T2, 226:58
var l8_t2_226_58 = ee.ImageCollection("LANDSAT/LC08/C01/T2_TOA")
        .filter(ee.Filter.eq('WRS_PATH', 226))
        .filter(ee.Filter.eq('WRS_ROW', 58))

        .select(['B4', 'B3', 'B2', ],['B3', 'B2','B1'])
        .filter(ee.Filter.inList('LANDSAT_PRODUCT_ID',ee.List(
          ['LC08_L1TP_226058_20131020_20170429_01_T2', 
            'LC08_L1GT_226058_20131105_20170428_01_T2',
            'LC08_L1TP_226058_20131121_20170428_01_T2',
            'LC08_L1TP_226058_20141108_20170417_01_T2',
            'LC08_L1TP_226058_20141124_20170417_01_T2',
            'LC08_L1TP_226058_20151127_20170401_01_T2',
            'LC08_L1TP_226058_20160809_20170322_01_T2',
            'LC08_L1TP_226058_20161129_20180528_01_T2',
            'LC08_L1GT_226058_20170812_20170824_01_T2',
            'LC08_L1TP_226058_20170828_20170914_01_T2',
            'LC08_L1GT_226058_20180815_20180828_01_T2',
            'LC08_L1TP_226058_20180831_20180912_01_T2',
            'LC08_L1TP_226058_20181002_20181010_01_T2',
            'LC08_L1TP_226058_20190818_20190902_01_T2',
            'LC08_L1GT_226058_20190919_20190926_01_T2',
            'LC08_L1TP_226058_20191005_20191018_01_T2'
          ])));


// Merge collection l8

var l8_merge = ee.ImageCollection(l8_t1_225_58.merge(l8_t2_225_58.merge(l8_t1_225_59.merge(l8_t2_225_59.merge(l8_t1_226_57.merge(l8_t2_226_57.merge(l8_t2_226_58 )))))));

Map.setCenter(-50.626565, 1.949439, 7);
Map.addLayer(l8_merge, {bands:['B3', 'B2', 'B1'], min:0, max:0.4, gamma:1.2}, 'l8');

//-------2019--------//

var img_2019 = ee.ImageCollection(l8_merge)
  .filterDate('2019-01-01', '2019-12-31');

Map.setCenter(-50.626565, 1.949439, 7);
Map.addLayer(img_2019, {bands:['B3', 'B2', 'B1'], min:0, max:0.4, gamma:1.2}, '2019');


// View ID list
var imageList = img_2019.toList(5000);
// print('imageList', imageList);
// Extract the ID of each image object.
var id_list = imageList.map(function(item) {
  return ee.Image(item).id();
});
print('img_2019 id', id_list);

// Get the number of images    
var count = img_2019.size();
print('img_2019 Count:', count);

var listOfImages = img_2019.toList(img_2019.size());

print('list', listOfImages);


var img1 = ee.Image(listOfImages.get[0]);
var img2 = ee.Image(listOfImages.get[1]);
var img3 = ee.Image(listOfImages.get[2]);
var img4 = ee.Image(listOfImages.get[3]);
var img5 = ee.Image(listOfImages.get[4]);
var img6 = ee.Image(listOfImages.get[5]);
var img7 = ee.Image(listOfImages.get[6]);
var img8 = ee.Image(listOfImages.get[7]);
var img9 = ee.Image(listOfImages.get[8]);
var img10 = ee.Image(listOfImages.get[9]);
var img11 = ee.Image(listOfImages.get[10]);
var img12 = ee.Image(listOfImages.get[11]);

print('img1', img1);

var img_14_10_2019 = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_225058_20191014')
  .select(['B3', 'B2', 'B1']);

print('14_10_2019', img_14_10_2019);

Map.setCenter(-50.080, 2.893, 7);
Map.addLayer(img_14_10_2019, {bands:['B3', 'B2', 'B1'], min:0, max:0.4, gamma:1.2}, 'img_14_10_2019');

Export.image.toDrive({
  image: img_14_10_2019,
  description: 'img1_2019',
  scale: 30,
  maxPixels: 10000000000000
});

图像下载为三个单独的Tif,但我无法将它们显示在QGIS上。我想知道代码是否正确,或者是否需要以某种方式进行调整?

javascript qgis google-earth-engine landsat
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.