簡體   English   中英

如何在 Google Earth Engine 中合並圖像?

[英]How to combine the images in Google Earth Engine?

因此,從 Sentinel 5P 圖像集合中,我在 3 年內創建了 3 張不同的圖像(平均值 - 2019 年、2020 年和 2021 年)。 然后我使用 Geometry 剪裁了這 3 張圖像,然后再次制作了 3 張圖像。 現在我想將這 3 個圖像組合成一個圖像,以便在從該組合圖像中提取數據時,我將能夠獲得 3 年(2019 年、2020 年和 2021 年)的數據。 我試過這個方法 -

var simpleJoin = ee.Join.simple();
var mod1join = ee.ImageCollection(simpleJoin.apply(img1clip, img2clip, img3clip));
Map.addLayer(mod1join, band_viz);

但是在加載圖層時它給了我一個錯誤 -

第 1 層:層錯誤:Join.apply,參數“輔助”:無效類型。 預期類型:FeatureCollection。 實際類型:圖像<[SO2_column_number_density]>。

我嘗試搜索此錯誤,但沒有找到任何解決方案。 將不同年份的 3 張圖像組合在一起,同時保留這些特定年份的數據的解決方案是什么?

下面我附上我所做和嘗試的代碼 -

var img1 = ee.ImageCollection(imageCollection
.select('SO2_column_number_density')
.filterBounds(geometry)
.filterDate('2019-01-01', '2019-12-31'))
//remove the negative values from the band
//.map(function(image){return image.updateMask(image.gte(0))});
print('no. of img1', img1.size());
var img2 = ee.ImageCollection(imageCollection
.select('SO2_column_number_density')
.filterBounds(geometry)
.filterDate('2020-01-01', '2020-12-31'))
print('no. of img2', img2.size());
var img3 = ee.ImageCollection(imageCollection
.select('SO2_column_number_density')
.filterBounds(geometry)
.filterDate('2021-01-01', '2021-12-31'))
print('no. of img3', img3.size());
var band_viz = {
  min: 0.0,
  max: 0.0005,
  palette: ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red']
};
var img1map = img1.mean();
var img2map = img2.mean();
var img3map = img3.mean();

//Map.addLayer (SP5map, band_viz);
var img1clip = img1map.clip(geometry);
var img2clip = img2map.clip(geometry);
var img3clip = img3map.clip(geometry);

//print(img1clip);

var simpleJoin = ee.Join.simple();
var mod1join = ee.ImageCollection(simpleJoin.apply(img1clip, img2clip, img3clip));
Map.addLayer(mod1join, band_viz);

僅供參考:所有 3 個剪輯圖像僅包含 1 個波段。

官方文檔來看, ee.Join.apply()的第一個和第二個參數都是FeatureCollection ,而第三個參數是一個Filter 一個工作示例是here

  1. img1是應用.filterDate()后的Collection
  2. img1clip是應用.mean()函數后的Image
  3. 應用.clip()后, img1clip也是一個Image ,它不是FeatureCollection

因此出現錯誤(無效類型)。

您必須檢查代碼並確保ee.Join.apply()的三個參數正確。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM