【问题标题】:How to export long time series of multiple locations from Google Earth Engine如何从 Google Earth Engine 导出多个位置的长时间序列
【发布时间】:2019-09-19 06:28:40
【问题描述】:

我想将不同点的 NDVI 时间序列导出为 csv。我目前有一个可以打印图表的代码,然后单击从图表中下载数据。有没有更好的方法,因为我不一定需要打开图表?

我现在有一个代码来打印一个位置的图表,然后我可以下载...我想要一种自动方式,这样我就不需要从图表下载。

var point = ee.Geometry.Point([-100, 50]);

var LS8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA');
var FieldLS8 = LS8.filterBounds(point).filterDate('1995-01-01', '2018-12-31').sort('CLOUD_COVER')

var cloudlessNDVI_LS8 = FieldLS8.map(function(image) {
  var cloud = ee.Algorithms.Landsat.simpleCloudScore(image).select('cloud');
  var mask = cloud.lte(50);
  var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI');
  return image.addBands(ndvi).updateMask(mask);
});

print(ui.Chart.image.series({
  imageCollection: cloudlessNDVI_LS8.select('NDVI'),
  region: point,
  reducer: ee.Reducer.first(),
  scale: 30
}).setOptions({title: 'LS8: Meadow Cloud-masked NDVI over time'}));

【问题讨论】:

    标签: time-series geospatial google-earth-engine


    【解决方案1】:

    您可以使用.getRegion 命令来完成。它输出一个数组,其中所有值都与您的几何重叠,因此您也可以使用多点几何。

    难点在于导出它,因为只能导出 FeatureCollections。这就是为什么您需要将其转换为 FeatureCollection 以将其导出。

    var points = ee.Geometry.MultiPoint(
            [[16.5, 11.3],
             [20.9, -14.5]]);
    
    var LS8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA');
    var FieldLS8 = LS8.filterBounds(points).filterDate('1995-01-01', '2018-12-31').sort('CLOUD_COVER')
    
    var cloudlessNDVI_LS8 = FieldLS8.map(function(image) {
      var cloud = ee.Algorithms.Landsat.simpleCloudScore(image).select('cloud');
      var mask = cloud.lte(50);
      var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI');
      return image.addBands(ndvi).updateMask(mask);
    });
    
    var poiArray = cloudlessNDVI_LS8.select('NDVI').getRegion(points, 30);
    
    var names = poiArray.get(0)
    var values = poiArray.slice(1)
    
    var exportFC = ee.FeatureCollection(
      values.map(function(values){
        return ee.Feature(null, ee.Dictionary.fromLists(names, ee.List(values)))
      })
    )
    
    var sortedFC = exportFC.sort('id')
    
    print(sortedFC)
    
    Export.table.toDrive(sortedFC)
    

    您将获得一个以点的经度/纬度为标识符的数组,您可以根据该数组对图表进行分组。

    【讨论】:

      猜你喜欢
      • 2019-03-29
      • 2021-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多