使用Google Earth Engine(一):提取下载MODIS、Landsat点数据

    现在可以使用Google Earth Engine 快捷的提取MODIS、Landsat等产品的点(或区域)数据到自己的Google Drive下载。PS:GEE可以做全球尺度长时间序列的数据分析出图等,将来必是地球科学领域的大杀器。这里下载数据不是仅运行下面代码就行,还需要注意两点:

 

1)那么如何找到数据集呢?在搜索栏输入产品名,便可快速定位到产品,点击产品名右侧的import可以导入产品数据集。点击代码窗体里导入产品数据集右侧的按钮可以查看导入的代码。

2)运行代码后会产生一个处理任务,需要在Tasks里找到任务并运行。

 

    大杀器的链接:https://code.earthengine.google.com/

    附一段提取MO09GA反射率产品点数据的示例代码:

 

代码参考:rodrigo-e-principe 在stackoverflow上的回答。

extract-pixel-values-by-points-and-convert-to-a-table-in-google-earth-engine

exporting-all-images-in-a-google-earth-engine-image-collection-google-earth-eng

// code goes here

// define point or point feature colection, format [longitude, latitude]

var pt1 = ee.Geometry.Point([24.9478,-17.8756]);

 

// For multi-point, Create a multi-part feature.
// var multiPoint = ee.Geometry.MultiPoint([[-121.68, 39.91], [-97.38, 40.34]]);
// var multiPoint = ee.Geometry.MultiPoint([[-121.68, 39.91], [-97.38, 40.34]]);

 

// import dataset filt with time, andgeometry (point)

var imageCollection =ee.ImageCollection("MODIS/006/MOD09GA")

 .filterDate('2014-01-01', '2015-01-03')

 .filterBounds(pt1);

 

// Empty Collection to fill

var ft = ee.FeatureCollection(ee.List([]))

 

var fill = function(img, ini) {

  //type cast

  var inift = ee.FeatureCollection(ini)

 

  //gets the values for the points in the current img

  var ft2 = img.reduceRegions(pt1, ee.Reducer.first(),500)

 

  //gets the date of the img

  var date = img.date().format()

 

  //writes the date in each feature

  var ft3 = ft2.map(function(f){return f.set("date", date)})

 

  //merges the FeatureCollections

 return inift.merge(ft3)

}

 

// Iterates over the ImageCollection

var newft =ee.FeatureCollection(imageCollection.iterate(fill, ft))

// Export

Export.table.toDrive({collection:newft,

description:'MOD09GA_point'})

 

  • 7
    点赞
  • 84
    收藏
    觉得还不错? 一键收藏
  • 12
    评论
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值