Search code examples
google-earth-engine

Clipping according to shapefile in google earth engine


I have a shapefile of intertidalArea now I want to clip my imagecollection according to that shapefile.

Map.addLayer(intertidalArea, {}, "Intertidal area")

var image5 = L5.filterDate('1987-01-01','2003-12-31').filterMetadata('CLOUD_COVER', 'less_than', 5)
.filterBounds(geometry)

var image8 = L8.filterDate('2013-01-01','2019-12-31').filterMetadata('CLOUD_COVER', 'less_than', 5)
.filterBounds(geometry)
var image5_set2 = L5.filterDate('2008-01-01','2012-12-31').filterMetadata('CLOUD_COVER', 'less_than', 5)
.filterBounds(geometry)
var collection = image5.merge(image5_set2).merge(image8)
.filter(ee.Filter.eq('WRS_PATH', 150))
.filter(ee.Filter.eq('WRS_ROW', 44));//sort('system:time_start');
//print(collection)

Solution

  • For ee.ImageCollection you have to use the .clip(yourGeometry) wrapped in a function and then mapped over the image collection. Here will be the link to GEE guide on mapping over image collection.