fromGeoInterface#

classmethod geetools.FeatureCollectionAccessor.fromGeoInterface(data)#

Create a FeatureCollection from a geo interface.

The geo_interface is a protocol representing a vector collection as a python GeoJSON-like dictionary structure. More information is available at https://gist.github.com/sgillies/2217756. Note that the ee.FeatureCollection constructor is only supporting data represented in EPSG:4326.

The user can either provide an object that implements the __geo_interface__ method or a dictionary that respects the protocol described in the link above.

Parameters:
  • data (dict | GeoInterface) – The geo_interface to create the FeatureCollection from.

  • crs – The CRS to use for the FeatureCollection. Default to “EPSG:4326”.

Returns:

The created FeatureCollection.

Return type:

ee.FeatureCollection

Examples

code-block:: python

import geetools

data = {

“type”: “FeatureCollection”, “features”: [

{

“type”: “Feature”, “properties”: {“name”: “Coors Field”}, “geometry”: {

“type”: “Point”, “coordinates”: [-104.99404, 39.75621]

}

}

]

}

fc = ee.FeatureCollection.geetools.fromGeoInterface(data, crs=”EPSG:4326”)