toFeatureCollection#

geetools.FeatureAccessor.toFeatureCollection()#

Convert a ee.Feature composed of a multiGeometry geometry into a ee.FeatureCollection.

Returns:

The FeatureCollection

Return type:

ee.FeatureCollection

Example

import ee, geetools
from geetools.utils import initialize_documentation

initialize_documentation()

geoms = ee.Geometry.MultiPoint([[0,0], [0,1]])
feature = ee.Feature(geoms).set("foo", "bar")
fc = feature.geetools.toFeatureCollection()
fc.getInfo()
{'type': 'FeatureCollection',
 'columns': {'foo': 'String', 'system:index': 'String'},
 'features': [{'type': 'Feature',
   'geometry': {'type': 'Point', 'coordinates': [0, 0]},
   'id': '0',
   'properties': {'foo': 'bar'}},
  {'type': 'Feature',
   'geometry': {'type': 'Point', 'coordinates': [0, 1]},
   'id': '1',
   'properties': {'foo': 'bar'}}]}