Filter and clip with feature collections

clipping with shapefiles in google earth engine

Step 1: add the country shapefile.

var country_names = ["??"];
// import the country feasture collection
var countries = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw');
// find the countries in the country list
var country = countries.filter(ee.Filter.inList('Country', country_names));
// Get the geometry of the countries
var region = country.geometry();


Step 2: create the landsat composite

// import imagecollection
var l8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR");

// filter for location
l8 = l8.filterBounds(??);

// print number of images

// filter for date;
l8 = l8.filterDate("??","??");

function removeClouds(image){

// get QA band
var QA ="pixel_qa");
var shadow = QA.bitwiseAnd(8).neq(0);
var cloud = QA.bitwiseAnd(32).neq(0);
return image.updateMask(shadow.not()).updateMask(cloud.not());

l8 =

step 3: calculate the median and clip the image

// calculate the median
var composite = l8.??
composite = composite.clip(region)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s