For each year, I need to take the max. of spring months from the representative rasters, and then clip the resulting "max raster" to each region in a feature collection. Ultimately, I need to automate the export of each of the resulting rasters (i.e. a raster for each year and each feature). So let's say...

  • feature_list is my Feature Collection
  • raster_collection is the Image Collection from the online catalog

    var years = ee.List.sequence(1984, 2015);

I assume I have to iterate over the years, such that I can...

year = ee.Number(year).toInt();
var startdate = ee.String(year).cat("-04-01");
var enddate = ee.String(year).cat("-06-30");
var WaterSpring = raster_collection.filterDate(startdate,enddate).max(); 

Then I need to clip by each "feat" in feature_list...

var WaterSubset = WaterSpring.clip(feat);
var Water = WaterSubset.gt(1);  // make Water binary
Water = Water.updateMask(Water.neq(0));

I have found both these questions...

Iterating over years for features in feature collection using Google Earth Engine?

How can I export a set of images from Google Earth Engine?

I can't quite figure out how to "reverse engineer" them though because it seems like I might be getting a multi-dimensional list as the output, or something like that.

UPDATE: If this makes the wording/concept simpler, I basically need to iterate or map over a Feature Collection and an Image Collection, such that I have a separate clipped image for each feature, for all images in the Image Collection.

1 Answer 1


Are the features really spread out in space? If not, why not just export the whole raster at once (without clipping)? If so, use clipToCollection() on each image. If you really need to export, you're going to have to use a for-loop, since Export is a client-side function.

  • you're right - we had broken them up by regions for smaller downloads, but the reason it wasn't exporting was because our export settings were slightly off. now, i'm using the whole region with tweaked settings and an export function provided by another user. thanks!
    – setophaga
    Commented Oct 11, 2017 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.