I realise that this question has been asked before as Extract pixel values by points and convert to a table in Google Earth Engine at Stack Overflow. However, I can't get the code to work. It runs, but the value of the raster isn't added to the table it just prints the point attributes
var yearly = ee.ImageCollection('JRC/GSW1_0/YearlyHistory');
Map.addLayer(yearly, {}, 'yearly', false);
var fg_points = ee.FeatureCollection('ft:1quTYHcLHQNy1yrssUPaubflVBEkGGMoPFLdbc_-J')
// 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(fg_points, 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(yearly.iterate(fill, ft));
// Export
Export.table.toDrive(newft,
"export_Points",
"export_Points",
"export_Points");
Best Answer
I have no access to your fusion table, so I made up one to make the answer.
First approach: 2D table
Second approach: 1D table
If features in your FeatureCollection have a
name
property (or something that identifies each feat) you can change in the second approach:for