I am creating a ML classifier to detect floods, but I need to find imagery to train it with. To do this, I am using a Fusion Table with thousands of flood events, their began/ended dates, and polygons of their extent.

I want to quickly find what imagery is available for these floods, then see if it is suitable for training. In GEE, I created a function to map over the fusion table, find Landsat image collections for the date range and bounds of a flood event, then put them together. The "putting together" part is causing me trouble.

I want to be able to set a flood ID property ('dfoID') for the images/image collections. That way I can see which flood they belong to later. Ideally, all the images from each flood event would be grouped into one image collection. However, because I map a Feature Collection, the output is a Feature Collection. I flatten this and then get one image collection but none of the dfoIDs remain on the images.

Here's the link to my code: https://code.earthengine.google.com/3c31496721f4a01c4d9c77933e408266

Any ideas for 1. Yielding an image collection of image collections; Or 2. Making the dfoIDs stick to either the individual images, or to an image collection of images for each flood event?

  • 2
    You should give access to your feature collection ft:1rhXEpchCNQGvEaL6mRv5O5hfRYfSzW-JUPfdz67c
    – Kuik
    Dec 19, 2018 at 8:05
  • Ah yes thank you, I have gone ahead and given access
    – la_leche
    Dec 19, 2018 at 15:19

1 Answer 1


You wrote a quite nice piece of code and you were almost there. I think the easiest solution is setting a property with the flood ID on every single image. In that way you can later filter the image collection on a selected ID and you will have all available images easily accessible.

Here is the piece of code you should add to the function 'filterIC' so flood ID's are set on the individual images:

// Function to filter the ImageCollection by date and bounds of flood event
function filterIC(ic, ft){
  var range = ee.DateRange(ft.get('Began'), ft.get('Ended'))
  var bounds = ft.geometry()
  var dfoID = ft.get('ID')
  return ic.filterBounds(bounds).filterDate(range).map(function(image){
return image.set('dfoID', dfoID);

You can find the full code here, where I added also the features to the map and an example of accessing images of a certain flood event: Script

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.