Monday, 15 February 2016

Clipping vs Filtering Images with a Polygon - Google Earth Engine



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



Answer



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...