I am trying to filter a MODIS image collection by country. I have seen a lot of examples where you can map the image collection over a function and clip to the country, but I was trying to simplify the code by filtering my image collection by the country geometry (.filterBounds) instead. I know I need to feed in a geometry to do this, so I tried to convert my country feature to a geometry, and then filter by .filterBounds. It does not return an error, but also does not filter to my country shape.

If there is not a way to get this to work, why is creating a function to clip an image better?

var canadaShape = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017').filter(ee.Filter.eq('country_na', 'Canada'));
var geometry = CanadaShape.geometry();
var terraCollection = ee.ImageCollection("MODIS/006/MOD10A1").select(['NDSI_Snow_Cover']).filterBounds(geometry).filter(ee.Filter.date('2019-11-01', '2020-05-01')); 

1 Answer 1


This should throw an error - you have a typo. CanadaShape.geometry() should be lowercased as in your variable declaration. Change it to var geometry = canadaShape.geometry(); and it works.

You could use a map function if you wanted to apply this across many countries, but if you only need to do one - filterBounds with a single geometry is the way to go.

  • Thank you! I also came across this answer: gis.stackexchange.com/questions/242581/…. It seems like with MODIS data it's better to do a clip function, but that the above would work well for other satellites! Commented Jun 24, 2020 at 16:09
  • @fjellrev123 filterBounds will filter a collection for images that intersect with those bounds. For MODIS global composites, that won't filter anything out, but for raw MODIS scenes it will. If you want the resulting collection to exclude pixels from the AOI, use clip. Commented Jun 24, 2020 at 18:14

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.