【发布时间】:2020-02-14 15:09:45
【问题描述】:
我如何通过改编@Rodrigo E. Principe 编写的这段漂亮代码来提取集合中的索引植被点:
Extract pixel values by points and convert to a table in Google Earth Engine
我尝试在 GEE 崩溃时提取所有值,因此只有 NDVI 或 EVI 可以正常工作。
【问题讨论】:
标签: apigee google-earth-engine
我如何通过改编@Rodrigo E. Principe 编写的这段漂亮代码来提取集合中的索引植被点:
Extract pixel values by points and convert to a table in Google Earth Engine
我尝试在 GEE 崩溃时提取所有值,因此只有 NDVI 或 EVI 可以正常工作。
【问题讨论】:
标签: apigee google-earth-engine
我通过本教程做到了https://developers.google.com/earth-engine/tutorial_api_06
// Dataset do sensor LS8
var dataset = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
.filterDate('2018-04-01', '2019-03-31')
.select('B5', 'B4')
.filterBounds(aoi6010)
.filter(ee.Filter.lt('CLOUD_COVER', 20));
var addNDVI = function(image) {
var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI');
return image.addBands(ndvi);
};
var withNDVI = dataset.map(addNDVI);
print(withNDVI);
// 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(p601018, ee.Reducer.first(),30)
// 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(withNDVI.iterate(fill, ft))
【讨论】: