Google Earth Engine(GEE)——计算总人口分析(世界人口数据集)
原创
©著作权归作者所有:来自51CTO博客作者此星光明的原创作品,请联系作者获取转载授权,否则将追究法律责任
代码:
// 在这个列表中定义感兴趣的国家
var countryList = ["Cambodia","Vietnam","Laos","Burma","Thailand"];
// 导入国家边界并对感兴趣的国家进行过滤
var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017').filter(ee.Filter.inList("country_na", countryList));
// 输入worldpop数据
var wp = ee.ImageCollection("WorldPop/GP/100m/pop").filterBounds(countries);
// 定义开始和结束时间
var start = ee.Date.fromYMD(2020,1,1);
var end = ee.Date.fromYMD(2020,12,31);
// 过滤时间
var wp2020 = ee.Image(wp.filterDate(start,end).mean());
// 边界裁剪
wp2020 = wp2020.clip(countries);
Map.addLayer(wp2020,{min:0,max:100,palette:['white','gray','black']},"population 2020");
var totalPopulation = wp2020.reduceRegion({reducer:ee.Reducer.sum(),scale:100,geometry:aoi})
print(totalPopulation)