如何通过crs过滤谷歌地球引擎图像集



我有一个脚本可以从谷歌地球引擎下载Sentinel-1图像,它可以在英国地区和欧洲其他地区完美运行。然而,当我尝试在挪威的一个地区运行它时,返回的图像是模糊的。我认为这是因为在ee.image集合中,一些图像具有不同的crs投影。

因此,我的问题是如何过滤图像以删除其他crs的图像?以下是它在谷歌地球引擎中的外观示例:

谷歌地球引擎中挪威地区的哨兵-1图像

以下是在谷歌地球引擎中显示两个投影的图像集合的打印结果(见显示EPSG:32632和EPSG32633的特征0和3(:

在挪威的谷歌地球引擎中打印图片集

我的谷歌地球引擎脚本包含在下面。若要复制此问题,请将挪威几何体替换为绘制的多边形。

var year = 2021;
var region = 9;
var mth = 'October';
var mthno1 = 10;
var mthno2 = 11;
var endday1 = 18;
var endday2 = 18;
var geometry = ee.FeatureCollection("users/nfigbfr/Norway");
var s1c = ee.ImageCollection('COPERNICUS/S1_GRD')
.filterBounds(geometry)
.filterDate(year+'-'+mthno1+'-'+endday1,year+'-'+mthno2+'-'+endday2)
.filter(ee.Filter.eq('transmitterReceiverPolarisation', ['VV','VH']))
.filter(ee.Filter.eq('instrumentMode', 'IW'))
.map(function(image) {
var edge = image.lt(-30.0);
var maskedImage = image.mask().and(edge.not());
return image.updateMask(maskedImage);
});
print(s1c)
var img = s1c.mean();
print(img)  
var img = img.addBands(img.select('VV').subtract(img.select('VH')).rename('Ratio'));
var img = img.select(['VV','VH','Ratio']).toFloat();
print(img);
var img_display = img.select(['VV','VH','Ratio']).clip(geometry);
Map.centerObject(geometry);
Map.addLayer(img_display, {min: -25, max: 0});
Export.image.toDrive({ 
image: img,
description: 'Norway_mean_'+mth+year,
folder: 'Sentinel_1',
crs: 'EPSG:32632',
scale: 10, 
maxPixels: 1e13, 
region: geometry 
});

crs是单个波段的属性,而不是图像。我也不知道我们是否/如何访问波段属性进行过滤。

然而,这里有一个变通方法:

var target_crs = 'EPSG:32671'
var s1c = ee.ImageCollection('COPERNICUS/S1_GRD')
.filterBounds(point)
.filterDate(year+'-'+mthno1+'-'+endday1,year+'-'+mthno2+'-'+endday2)
.filter(ee.Filter.eq('transmitterReceiverPolarisation', ['VV','VH']))
.filter(ee.Filter.eq('instrumentMode', 'IW'))
.map(function(image) {
var edge = image.lt(-30.0);
var maskedImage = image.mask().and(edge.not());
return image.updateMask(maskedImage);
})
.map(function(img){
var crs = img.select(['VV']).projection().crs()
var myImageWithProperties = x.set({
crs: crs})
return ee.Image(myImageWithProperties)
;})
.filter(ee.Filter.eq('crs', target_crs));

我添加了一个.map((函数,它从VV波段获取投影代码(EPSG(,并将其设置为图像属性。然后我们可以基于此属性筛选集合。

我在Sentinel-2上试过这个,效果很好。不过,仍然很好奇是否有更简单的方法。

附言:这个问题更适合https://gis.stackexchange.com

最新更新