15

I need to analyze the area defined by a polygon that I drew (call it 'X') of the images of Modis Terrra. What is the difference between filtering bounds and clipping to define the area of interest?

I'm confused about the following alternatives:

option 1.

var areaofinterest=ee.ImageCollection('NASA/OCEANDATA/MODIS-Aqua/L3SMI');
    .filterBounds(X)

or option 2.

var aux=ee.ImageCollection('NASA/OCEANDATA/MODIS-Aqua/L3SMI');
var areaofinterest=aux.clip(X);

The main question is: what are the differences between the two methods?

  • When I do option 1 and then Map.AddLayer(areaofinterest) I don't get displayed the area of interest, but the map of the product over the whole world - so I guess something is wrong.
  • When I do option 2 I get the error: aux.clip is not a function in <global>
1
  • Hi, I see you're new to SO. If you feel an answer solved the problem, please mark it as 'accepted' by clicking the green check mark. This helps keep users focused on answer questions which still don't have accepted answers. Commented Jan 6, 2019 at 19:42

2 Answers 2

29

Clip sets the mask of the image outside the geometry with which you're clipping to zero. Note that clip() is a function on images (NOT image collections). On the other hand, filterBounds() passes elements of the input collection that have geometries intersecting the geometry with which you're clipping. If the images in the collection are global composites (e.g. MODIS images), then filterBounds() won't do anything.

4
  • Thank you Nicholas, for some reason my question was put on hold as too broad by the community manager, but your answer makes it clearer. I am indeed using MODIS and that might be why I'm not getting anything. If clip() is not a function of image collections - how can I do the clipping for an image collection?
    – Raimundo
    Commented Jul 19, 2017 at 14:34
  • 13
    imageCollection.map(function(image) { return image.clip(geometry); }); Commented Jul 19, 2017 at 18:22
  • 1
    How do I know if the images in the collection are "global composites"? I am extracting Sentinel 2 images using (python) ``` s2_image_collection = ee.ImageCollection("COPERNICUS/S2_SR") ``` Does that return images that are global composites?
    – Vincent
    Commented Feb 11, 2020 at 20:54
  • You could add image.geometry() to the map or inspect the coordinates in the system:footprint property. Commented Feb 12, 2020 at 2:20
0

It's true that filterBounds() won't do anything to a MODIS imageCollection. Only clip() works with the individual images inside the collection by a function, imageCollection.map(function(image) { return image.clip(geometry); }), which has been presented by Nick.

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.