google-earth-engine - 如何将图像集合剪辑到特征集合的几何图形
问题描述
我正在尝试将图像集剪辑到阿尔伯塔省,但 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 :-(
解决方案
一种简单的方法是:
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)});
推荐阅读
- azure - Azure 前端 Web APP 和 Azure APIM 相互客户端证书身份验证不起作用
- java - spring-data-hazelcast @Query 注释给出 NullPointerException
- swift - 期望 SwiftUI DynamicProperty 属性包装器的内部更新来触发视图更新是否正确?
- javascript - 谷歌脚本:变量总是显示未定义
- c - 如何在c中正确扫描txt文件中的东西
- vue.js - 构建 Vue 微前端应用(带有路由和 vuex 商店)
- angular - 找不到“路径”模块中的错误:错误:无法解析 - Angular 6 Webpack
- php - Facebook - 消息传递 webhook 不断循环回调 php 文件
- r - 使用 R 和 rvest 进行网页抓取
- docker - 如何从 docker 容器内的应用程序发布 Web 服务?