使用 SENTINEL 1 和 2 进行土地覆盖分类

1.前言

         Sentinel-1 和 Sentinel-2 卫星都以非常高的空间分辨率和良好的时间分辨率对地球进行测量。 这些数据对于绘制土地利用和土地利用变化图非常有用。 本教程展示了如何使用简单的算法来识别水、茂密植被、定居点和稻田的区域。

2.代码实现

(1)导入 Sentinel-1 和 Sentinel-2 ImageCollection

 (2)定义地理和时间域

// Define period
var startdate = ee.Date.fromYMD(2014,1,1);
var enddate = ee.Date.fromYMD(2016,12,1);
 
// Define geograpic domain
var Ca = ee.FeatureCollection('ft:1T7GmJ0tJCu4QwclY5qiG9EGBFgNhhNjttq8F7gQm');
Map.centerObject(Ca,8);

(3) 过滤数据

// filter s2 data</pre>
var Sentinel2 = s2.filterBounds(Ca)
.filterDate(startdate, enddate)
.filterBounds(Ca);
 
// filter s1 data
var Sentinel1 =  ee.ImageCollection('COPERNICUS/S1_GRD')
.filterBounds(Ca)
.filterDate(startdate, enddate)
.filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
.select('VV');

(4) 从 Sentinel-2 移除云层

// cloud function to remove clouds
var cloudfunction_ST2 = function(image){
  //use add the cloud likelihood band to the image
  var quality = image.select("QA60").unmask();
  //get pixels above the threshold
  var cloud01 = quality.gt(0);
  //create a mask from high likelihood pixels
  var cloudmask = image.mask().and(cloud01.not());
  //mask those pixels from the image
  return image.updateMask(cloudmask);
};
 
// remove the clouds
var ST2_nocloud = Sentinel2.map(cloudfunction_ST2);

(5) 从 Sentinel-2 的中值计算 NDBI、NDVI 和 NDWI

// take the median
var st2median = ST2_nocloud.median();
 
// the normalized difference bare index
var ndbi = st2median.normalizedDifference(['B12', 'B8']);
 
// the normalized difference vegetation index
var ndvi = st2median.normalizedDifference(['B8', 'B4']);
 
// the normalize difference water index
var ndwi = st2median.normalizedDifference(['B3', 'B8']);

 (6)设置索引的阈值

// define thresholds
var bareThreshold = -0.32
var vegetationThreshold = 0.65
var waterThreshold = 0.2

 (7)将不同的图层添加到画布

// show the urban area
var ndbi_th = ndbi.gt(bareThreshold)
var myndbi = ndbi_th.updateMask(ndbi_th).clip(Ca)
var ndbi_viz = {palette:"111101"};
Map.addLayer(myndbi, ndbi_viz, 'Urban');
 
// show the water areas
var ndwi_th = ndwi.gt(waterThreshold)
var myndwi = ndwi_th.updateMask(ndwi_th).clip(Ca)
var ndwi_viz = {palette:"24069b"};
Map.addLayer(myndwi, ndwi_viz, 'Water');
 
// show the forests
var ndvi_th = ndvi.gt(vegetationThreshold)
var myndvi = ndvi_th.updateMask(ndvi_th).clip(Ca)
var ndvi_viz = {palette:"006b0c"};
Map.addLayer(myndvi, ndvi_viz, 'Vegetation');

 (8)在 sentinel-1 图像上使用 reducer 函数比较干湿条件

// create a map of the wet and dry conditions from sentinel-1
var wet = Sentinel1.reduce(ee.Reducer.percentile([10]))
var dry = Sentinel1.reduce(ee.Reducer.percentile([90]))

(9) 识别在雨季被淹没而在旱季干燥的稻田

// calculate the difference between wet and dry conditions
var paddies = wet.subtract(dry)

(10) 山可以被识别为稻田,所以我们去除所有大于 2 度的坡度

// remove the mountains from the data
var hydrosheds = ee.Image('WWF/HydroSHEDS/03VFDEM');
var terrain = ee.Algorithms.Terrain(hydrosheds);
var slope = terrain.select('slope');
 
// remove all slopes greater then 2 degrees
paddies = paddies.updateMask(slope.lt(2));

(11) 还根据 -8 的阈值将稻田添加到地图中

// set the paddy threshold
var paddies_th = -8;
 
// select areas smaller than the threshold
var paddies_th = paddies.lt(paddies_th);
 
// mask the areas that are not rice paddies
var mypaddies = paddies_th.updateMask(paddies_th).clip(Ca)
 
var paddies_viz = {palette:"c2c64d"};
Map.addLayer(mypaddies, paddies_viz, 'Rice');

3.实现效果 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

倾城一少

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

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

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

打赏作者

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

抵扣说明:

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

余额充值