mergeGeometries#

geetools.ee_feature_collection.FeatureCollectionAccessor.mergeGeometries(maxError=None)#

Merge the geometries included in the features.

Parameters:

maxError (float | int | ee.Number | None) – The maximum amount of error tolerated when performing any necessary re-projection.

Returns:

The dissolved geometry.

Return type:

ee.Geometry

Example

import ee, geetools
from geetools.utils import initialize_documentation
from matplotlib import pyplot as plt

initialize_documentation()

# create a FeatureCollection containing 2 bounding boxes
fc = ee.FeatureCollection([
    ee.Geometry.BBox(-1, -1, 1, 1),
    ee.Geometry.BBox(0, 0, 2, 2)
])

# merge them into a single geometry
geometry = fc.geetools.mergeGeometries(maxError=.1)

# print the geometry on a matplotlib graph
fig, ax = plt.subplots(figsize=(10, 5))
c = ee.FeatureCollection(geometry).geetools.plot(boundaries=True, color="teal", ax=ax)

fig.show()