Tyler Erickson b6bc527937 JavaScript API: added examples.
Python API: added support for specifying a geometry column when accessing
a Fusion Table as a vector data source.
2012-11-16 14:33:08 -08:00

23 lines
653 B
JavaScript

// Reverse mask a region
// #section FeatureCollection:4
//
// Create an image that masks everything except for the specified polygon.
var fc = ee.FeatureCollection('ft:1Ec8IWsP8asxN-ywSqgXWMuBaxI6pPaeh6hC64lA')
.filter(ee.Filter().eq('ECO_NAME', 'Great Basin shrub steppe'));
// Start with a black image.
var empty = ee.Image(0).toByte();
// Fill and outline the polygons in two colors
var filled = empty.paint(fc, 2);
var both = filled.paint(fc, 1, 5);
// Mask off everything that matches the fill color.
var result = both.mask(filled.neq(2));
addToMap(result, {
palette: '000000,FF0000',
max: 1,
opacity: 0.5
});
centerMap(-100, 40, 4);