【GEE合集】欧空局10m土地利用数据已更新至2021,附GEE代码对比两期变化。

该博客介绍了如何利用Google Earth Engine (GEE)对比欧洲空间局(ESA)发布的2020年和2021年10米分辨率土地利用数据。作者提供了详细的代码示例,展示如何加载数据、设置地图以及添加图例,以观察和分析两期数据之间的差异。文章还鼓励读者点赞、收藏和关注以支持更多此类内容的更新。

【GEE合集】欧空局10m土地利用数据已更新至2021,附GEE代码对比两期变化!

1.引言

最近欧空局更新了10m的土地利用数据,本文通过gee来对比两期数据的变化,记录在此,分享给有需要的同学。
在这里插入图片描述
在这里插入图片描述

2.调用展示

var lc20 = ee.ImageCollection("ESA/WorldCover/v100").first()
var lc21 = ee.ImageCollection("ESA/WorldCover/v200").first()


var leftMap = ui.Map(); //left Map
var rightMap = ui.Map(); //right Map

leftMap.setCenter(111,35,3);
rightMap.setCenter(111,35,3);
leftMap.setControlVisibility(false);
rightMap.setControlVisibility(false);

var linker = new ui.Map.Linker([leftMap,rightMap]); //Link Left Map and Right Map

var splitPanel = ui.SplitPanel({
firstPanel:leftMap,
secondPanel:rightMap,
orientation:'horizontal',
wipe:true
});

ui.root.clear();
ui.root.add(splitPanel);

leftMap.addLayer(lc20);
rightMap.addLayer(lc21);

在这里插入图片描述

3.添加图例

添加图例部分参考大神的这篇博客

// set position of panel
var legend = ui.Panel({
  style: {
    position: 'bottom-left',
    padding: '8px 15px'
  }
});

// Create legend title
var legendTitle = ui.Label({
  value: 'ESA Landcover',
  style: {
    fontWeight: 'bold',
    fontSize: '18px',
    margin: '0 0 4px 0',
    padding: '0'
    }
});

// Add the title to the panel
legend.add(legendTitle);

// Creates and styles 1 row of the legend.
var makeRow = function(color, name) {
  // Create the label that is actually the colored box.
  var colorBox = ui.Label({
    style: {
      backgroundColor: '#' + color,
      // Use padding to give the box height and width.
      padding: '8px',
      margin: '0 0 4px 0'
    }
  });
  // Create the label filled with the description text.
  var description = ui.Label({
    value: name,
    style: {margin: '0 0 4px 6px'}
  });
  // return the panel
  return ui.Panel({
  widgets: [colorBox, description],
  layout: ui.Panel.Layout.Flow('horizontal')
  });
};
 
//  from ESA get palette and names
var palette = ee.List(lc20.get('Map_class_palette')).getInfo()
var names = ee.List(lc20.get('Map_class_names')).getInfo()

// Add color and and names
for (var i = 0; i <palette.length; i++) {
  print(palette[i], names[i])
  legend.add(makeRow(palette[i], names[i]));
  }  
 
// add legend to map
leftMap.add(legend);

在这里插入图片描述
以上就是gee对比欧空局两期土地利用的全部内容了,如果对你有帮助的话,请‘点赞’、‘收藏’,‘关注’,你们的支持是我更新的动力。

### Google Earth Engine 中的土地利用数据获取与使用方法 #### 1. 数据源介绍 Google Earth Engine (GEE) 提供多种高分辨率土地利用/土地覆盖(LULC)数据集。其中包括欧空局发布的WorldCover 10 m分辨率的数据集,涵盖了2020年的全球陆地表面情况[^1]。此外,还有中国科学院资源环境科学数据中心提供的CLCD数据集,其分辨率为30,时间跨度从1985年至2023年[^2]。 #### 2. 加载并可视化特定区域内的LULC数据 为了加载这些数据,在JavaScript API中可以采用如下方式: 对于WorldCover 2020 V100版本: ```javascript var dataset = ee.ImageCollection('ESA/WorldCover/v100'); Map.addLayer(dataset, {min: 0,max: 10}, 'Land Cover Map', true); ``` 而对于CLCD系列,则可以通过指定具体年份来访问不同时间段的地图信息: ```javascript // Load the CLCD collection. var clcd = ee.ImageCollection('projects/sat-io/open-datasets/clcd'); // Filter by year and region of interest here... var filteredClcd = clcd.filterDate('2020-01-01','2020-12-31') .filterBounds(geometry); // Add to map with custom palette or classification scheme applied as needed. Map.addLayer(filteredClcd.first(), {}, "China Land Use Classification Data"); ``` #### 3. 将栅格转换成矢量格式 当需要将上述获得的栅格形式的土地利用分类图层转化为矢量文件时,可以直接调用`reduceToVectors()`函数完成这一操作。此过程相对简单快捷,并且能够有效避免传统桌面GIS软件处理大尺寸影像时常遇到的问题,比如内存溢出错误或是长时间等待等问题[^3]。 ```javascript // Assuming you have an image object named 'image' that contains classified land cover data. // Convert raster cells into vector features based on unique class values within each cell. var vectors = image.reduceToVectors({ reducer: ee.Reducer.countEvery(), geometry: geometry, scale: 10, // Set appropriate spatial resolution according to your input data set's properties. maxPixels: 1e9 }); // Display resulting feature collection on the interactive web-based interface provided by GEE. Map.addLayer(vectors, null, 'Vectorized Polygons from Raster Classes'); ``` 通过这种方式可以在不依赖本地计算资源的情况下快速得到高质量的结果,非常适合于大规模时空数据分析任务的需求。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值