在Google Earth Engine(GEE)中利用人口数据进行分析

今天来分享下如何在GEE中利用人口数据进行分析,在GEE调用的数据为"WorldPop/GP/100m/pop"
分析山西省2001年到2020年人口的增长变化情况
GEE调用代码如下:

var roi = ee.FeatureCollection('users/lilei655123/shanxi')
Map.centerObject(roi,6)
var clipToCol = function(image){
  return image.clip(roi);
};
// import worldpop data
var worldpop = ee.ImageCollection("WorldPop/GP/100m/pop").filterBounds(roi).map(clipToCol)
                           .filter(ee.Filter.eq('country', 'CHN')).select('population')
print(worldpop)
var start = ee.Date.fromYMD(2020,1,1);
var end = ee.Date.fromYMD(2020,12,31);
var worldpop2020 = ee.Image(worldpop.filterDate(start,end).mean());
worldpop2020 = worldpop2020.clip(roi);
Map.addLayer(worldpop2020,{min:0,max:100,palette: ['24126c', '1fff4f', 'd4ff50']},"population 2020");
var chart =
    ui.Chart.image.seriesByRegion
        ({
          imageCollection:worldpop,
          regions: roi,
          reducer: ee.Reducer.sum(),
          scale: 100,
          xProperty: 'system:time_start'
        })
        .setSeriesNames(['population'])
        .setOptions({
          title: 'population dynamics',
          hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},
          vAxis: {
            title: 'total population',
            titleTextStyle: {italic: false, bold: true}
          },
          lineWidth: 5,
          colors: ['e37d05'],
          curveType: 'function'
        });
print(chart);
//导出影像数据函数
function exportImage(image, region, fileName) {  
   Export.image.toDrive({  
      image: image,  
      description: fileName,  
      fileNamePrefix: fileName, 
      folder: "population",  
      scale: 100, 
      region: roi,  
      maxPixels: 1e13, 
      fileFormat:"GeoTIFF", 
      crs: "EPSG:4326"  
  });  
} 
//获取每幅影像对应的时间
var indexList = worldpop.reduceColumns(ee.Reducer.toList(), ["system:index"]).get("list");  
print("indexList", indexList);

//循环导出影像,用影像时间对其命名
indexList.evaluate(function(indexs) {  
for (var i=0; i<indexs.length; i++) {  
      var image = worldpop.filter(ee.Filter.eq("system:index", indexs[i])) 
                           .first() 
                           .int16() 
      exportImage(image, roi, "Worldpop-"+indexs[i]); 
  }  
});

可视化结果:
在这里插入图片描述
图中颜色为绿色的区域,表示人口密度越大
统计结果
在这里插入图片描述
点击“run”,即可批量下载
在这里插入图片描述
感谢关注,欢迎转发!

声明:仅供学习使用!如果对你有帮助的话记得给小编点个赞

**更多内容请关注微信公众号“生态遥感监测笔记”

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

生态遥感监测笔记

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值