FeatureCollection Overview

Groups of related features can be combined into a FeatureCollection, to enable additional operations on the entire set such as filtering, sorting and rendering. Besides just simple features (geometry + properties), feature collections can also contain other collections.

The FeatureCollection constructor

One way to create a FeatureCollection is to provide the constructor with a list of features. The features do not need to have the same geometry type or the same properties. For example:

// Make a list of Features.
var features = [
  ee.Feature(ee.Geometry.Rectangle(30.01, 59.80, 30.59, 60.15), {name: 'Voronoi'}),
  ee.Feature(ee.Geometry.Point(-73.96, 40.781), {name: 'Thiessen'}),
  ee.Feature(ee.Geometry.Point(6.4806, 50.8012), {name: 'Dirichlet'})
];

// Create a FeatureCollection from the list and print it.
var fromList = ee.FeatureCollection(features);
print(fromList);

Individual geometries can also be turned into a FeatureCollection of just one Feature:

// Create a FeatureCollection from a single geometry and print it.
var fromGeom = ee.FeatureCollection(ee.Geometry.Point(16.37, 48.225));
print(fromGeom);

Table Datasets

Earth Engine hosts a variety of table datasets. To load a table dataset, provide the table ID to the FeatureCollection constructor. For example, to load TIGER roads data:

var fc = ee.FeatureCollection('TIGER/2016/Roads');
Map.setCenter(-73.9596, 40.7688, 12);
Map.addLayer(fc, {}, 'Census roads');

Note that as with image datasets, you can search for table datasets and import them into your script using the Code Editor search tool. There is a list of selected vector datasets hosted by Earth Engine on this page.

Fusion Tables

Google Fusion Tables is a separate Google service that also hosts tables. A Fusion Table is more limited in size than an Earth Engine table, but offers lower latency. To load a FeatureCollection from a Fusion Table, supply the constructor with the table ID appended to ft:. For example:

// Load a FeatureCollection from a Fusion Table.
var fromFT = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw');

// Print and display the FeatureCollection.
print(fromFT);
Map.addLayer(fromFT, {}, 'From Fusion Table');

Note that the ID of the Fusion Table is everything after the ft: and before the closing quote. To find this ID from the Fusion Tables interface, go to File > About this table and copy the encrypted ID from the ‘Id’ section. You can also find the ID after the ‘docid=’ in the table’s URL. Learn more about using Fusion Tables in Earth Engine from the Import section.

Random Samples

To get a collection of random points in a specified region, you can use:

// Define an arbitrary region in which to compute random points.
var region = ee.Geometry.Rectangle(-119.224, 34.669, -99.536, 50.064);

// Create 1000 random points in the region.
var randomPoints = ee.FeatureCollection.randomPoints(region);

// Display the points.
Map.centerObject(randomPoints);
Map.addLayer(randomPoints, {}, 'random points');

Send feedback about...

Google Earth Engine API