我正在尝试剪辑一个图像集合到艾伯塔省,但filterBounds不工作。感谢您能提供的任何帮助!我希望裁剪图像集合,而不仅仅是地图上的图层,因此当我在图像集合上执行操作时,它们将仅针对艾伯塔省执行
var Admins = ee.FeatureCollection("FAO/GAUL/2015/level1");
var Alberta = Admins.filter(ee.Filter.eq('ADM1_NAME', 'Alberta'));
print(Alberta)
Map.addLayer(Alberta, {}, 'Alberta')
Map.centerObject(Alberta, 6)
//Load NTL data for 2018, find the median value for each pixel
var dataset = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG')
.filter(ee.Filter.date('2018-12-01', '2018-12-31'))
.filterBounds(Alberta); //here I'm trying to clip the image collection
var nighttime = dataset.select('avg_rad');
var nighttimeVis = {min: 0.0, max: 60.0};
print(nighttime)
Map.addLayer(nighttime.median(), nighttimeVis, 'Nighttime'); //this layer still shows the whole world :-(发布于 2020-04-15 19:58:08
一种简单的方法是:
var dataset = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG')
.filter(ee.Filter.date('2018-12-01', '2018-12-31'))
.map(function(image){return image.clip(Alberta)});发布于 2020-04-15 11:46:19
我想通了。我编写了一个函数来裁剪图像,并将其应用于图像集合。
//Create feature for Alberta Boundary
var Admins = ee.FeatureCollection("FAO/GAUL/2015/level1");
var Alberta = Admins.filter(ee.Filter.eq('ADM1_NAME', 'Alberta'));
print(Alberta)
Map.addLayer(Alberta, {}, 'Alberta')
Map.centerObject(Alberta, 6)
//Load NTL data for 2018, find the median value for each pixel
var dataset = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG')
.filter(ee.Filter.date('2018-12-01', '2018-12-31'))
.filterBounds(Alberta); //here I'm trying to clip the image to Alberta
function clp(img) {
return img.clip(Alberta)
}
var clippedVIIRS = dataset.map(clp)
print(clippedVIIRS)
var nighttime = clippedVIIRS.select('avg_rad');
var nighttimeVis = {min: 0.0, max: 60.0};
Map.addLayer(nighttime.median(), nighttimeVis, 'Nighttime');https://stackoverflow.com/questions/61220828
复制相似问题