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();
Map.addLayer(region);
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
print(l8.size());
// filter for date;
l8 = l8.filterDate("??","??");
function removeClouds(image){
// get QA band
var QA = image.select("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 = l8.map(removeClouds)
step 3: calculate the median and clip the image
// calculate the median
var composite = l8.??
composite = composite.clip(region)
Map.addLayer(composite,{min:0,max:3000,bands:"B4,B3,B2"})