mirror of
https://github.com/google/earthengine-api.git
synced 2026-01-25 14:58:09 +00:00
Python API: added support for specifying a geometry column when accessing a Fusion Table as a vector data source.
30 lines
893 B
JavaScript
30 lines
893 B
JavaScript
// From polygons
|
|
// #section FeatureCollection:1
|
|
//
|
|
// Create and render a feature collection from polygons.
|
|
|
|
var fc = new ee.FeatureCollection([
|
|
ee.Feature(
|
|
ee.Feature.Polygon(
|
|
[[-109.05, 41], [-109.05, 37], [-102.05, 37], [-102.05, 41]]),
|
|
{name: 'Colorado', fill: 1}),
|
|
ee.Feature(
|
|
ee.Feature.Polygon(
|
|
[[-114.05, 37.0], [-109.05, 37.0], [-109.05, 41.0],
|
|
[-111.05, 41.0], [-111.05, 42.0], [-114.05, 42.0]]),
|
|
{name: 'Utah', fill: 2})
|
|
]);
|
|
|
|
// Fill, then outline the polygons into a blank image.
|
|
var image1 = ee.Image(0).mask(0).toByte();
|
|
var image2 = image1.paint(fc, 'fill'); // Get color from property named 'fill'
|
|
var image3 = image2.paint(fc, 3, 5); // Outline using color 3, width 5.
|
|
|
|
addToMap(image3, {
|
|
palette: '000000,FF0000,00FF00,0000FF',
|
|
max: 3,
|
|
opacity: 0.5
|
|
});
|
|
|
|
centerMap(-107, 41, 6);
|