I'm trying to collect a set of sample points from all the images in a collection. However instead of outputting a Feature Collection that consists of a group of Features with the training data as properties, I get a Feature Collection that contains another nested Feature Collection for each image I process, and cannot tell if these contain the training data I want.
How can I output the data as one featureCollection containing nothing but features? Do I have to use the .iterate()? From the examples I am unsure how to apply this for my purpose.
// Create Example Collection
var collection = ee.ImageCollection("LANDSAT/LT05/C01/T1_TOA")
.filterDate('2001-01-01', '2001-12-31')
.filterBounds(ee.Geometry.Point(-92.94,37.52))
.filterMetadata('CLOUD_COVER', 'equals', 0);
print(collection);
// function for sampling training data
function sampleImage(image) {
var bands = ['B1', 'B2', 'B3'];
var param = {region: clust, scale: 30, numPixels: 500};
var SamPix = image.select(bands).sample(param);
return SamPix;
}
var training = collection.map(sampleImage);
print(training, "sample points");