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

5 篇文章 0 订阅

【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对比欧空局两期土地利用的全部内容了,如果对你有帮助的话,请‘点赞’、‘收藏’,‘关注’,你们的支持是我更新的动力。

  • 7
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要下载土地利用数据,您可以使用Google Earth Engine(GEE)提供的代码。首先,您需要加载土地覆盖数据集并选择您感兴趣的区域。代码示例如下: // Load the land cover data var landCover = ee.Image('USGS/NLCD/NLCD2016'); 接下来,您需要根据需要调整代码中的经纬度坐标和其他参数,并将土地覆盖数据集剪切为感兴趣区域。代码示例如下: // Define the region of interest (ROI) using latitude and longitude coordinates var lat1 = 40.0; // Replace with your desired latitude var lon1 = -105.0; // Replace with your desired longitude var lat2 = 40.2; // Replace with your desired latitude var lon2 = -104.8; // Replace with your desired longitude var roi = ee.Geometry.Rectangle(lon1, lat1, lon2, lat2); // Clip the land cover data to the ROI var clippedLandCover = landCover.clip(roi); 然后,您可以将剪切后的土地覆盖数据添加到地图上进行可视化。代码示例如下: // Add the clipped land cover data to the map for visualization Map.addLayer(clippedLandCover, {}, 'Land Cover Data'); 最后,您可以将剪切后的土地覆盖数据导出为GeoTIFF图像进行下载。代码示例如下: // Export the clipped land cover data as a GeoTIFF image Export.image.toDrive({ image: clippedLandCover, description: 'land_cover_data', // Replace with your desired file name scale: 30, // Replace with your desired scale region: roi // Replace with the ROI geometry }); 请根据您的需要替换代码中的经纬度坐标、导出名称和其他参数,并运行代码以下载土地利用数据。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [使用Google Earth Engine (GEE)下载土地覆盖数据](https://blog.csdn.net/weixin_58851039/article/details/130522162)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值