Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
giswqs
GitHub Repository: giswqs/geemap
Path: blob/master/examples/javascripts/ClippedComposite.js
2313 views
1
// Composite an image collection and clip it to a boundary.
2
3
// Load Landsat 7 raw imagery and filter it to April-July 2000.
4
var collection = ee.ImageCollection('LANDSAT/LE07/C01/T1')
5
.filterDate('2000-04-01', '2000-07-01');
6
7
// Reduce the collection by taking the median.
8
var median = collection.median();
9
10
// Load a table of state boundaries and filter.
11
var fc = ee.FeatureCollection('TIGER/2016/States')
12
.filter(ee.Filter.or(
13
ee.Filter.eq('NAME', 'Nevada'),
14
ee.Filter.eq('NAME', 'Arizona')));
15
16
// Clip to the output image to the Nevada and Arizona state boundaries.
17
var clipped = median.clipToCollection(fc);
18
19
// Display the result.
20
Map.setCenter(-110, 40, 5);
21
var visParams = {bands: ['B3', 'B2', 'B1'], gain: [1.4, 1.4, 1.1]};
22
Map.addLayer(clipped, visParams, 'clipped composite');
23
24