I want to make a Landsat image collection that is totally cloud free over a SET of polygons. I have about 300 polygons (all within a single Landsat tile). I found this question, which is doing exactly what I want over a single polygon, but I can't figure out how to get it to work over a set of polygons (which are loaded as a feature class).
Here is what I tried to do to modify the solution from the question posted above, where imgcollection is my Landsat TOA Image Collection and fc is my feature class of polygons. I was trying to use map and clip together to select all the polygons in the feature class for each image (based on the answers in this related question).
var combine = imgcollection.map(function(imgcollection) { return
imgcollection.clip(fc); });
After this line, I tried to continue with the solution from the first question, but it doesn't work. The error I get is as follows, which confuses me. I'm trying to use the variable "combine" as the geometry - am I misunderstanding this and actually using something else?
ImageCollection (Error)
Image.reduceRegion, argument 'geometry': Invalid type. Expected:
Geometry. Actual: ImageCollection.
EDIT: full code
var fc = ee.FeatureCollection('ft:omit');
var imgcollection = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT_TOA");
var combine = imgcollection.map(function(img) { return img.clip(fc); });
var withCloudiness = combine.map(function(image) {
var cloud = ee.Algorithms.Landsat.simpleCloudScore(image).select('cloud');
var cloudiness = cloud.reduceRegion({
reducer: 'mean',
geometry: combine,
scale: 30,
});
return image.set(cloudiness);
});
var filteredCollection = withCloudiness.filter(ee.Filter.lt('cloud', 10));
print(filteredCollection);
ImageCollection
must be anImage
. Should be:var combine = imgcollection.map(function(img) { return img.clip(fc); });