AI-generated Key Takeaways
-
The
FeatureCollection.bounds()method constructs a bounding box around the geometries within a collection. -
The method can optionally accept
maxErrorandprojarguments to control reprojection error tolerance and the output projection. -
It returns a
Geometryobject representing the calculated bounding box. -
Examples are provided demonstrating its use in both JavaScript and Python.
| Usage | Returns |
|---|---|
FeatureCollection.bounds(maxError, proj) | Geometry |
| Argument | Type | Details |
|---|---|---|
this: collection | FeatureCollection | The collection whose bounds will be constructed. |
maxError | ErrorMargin, optional | The maximum amount of error tolerated when performing any necessary reprojection. |
proj | Projection, optional | If specified, the result will be in this projection. Otherwise it will be in EPSG:4326. |
Examples
Code Editor (JavaScript)
// FeatureCollection of power plants in Belgium. var fc = ee.FeatureCollection('WRI/GPPD/power_plants') .filter('country_lg == "Belgium"'); print('Bounds of Belgium power plants:', fc.bounds()); // ee.Geometry
import ee import geemap.core as geemap
Colab (Python)
# FeatureCollection of power plants in Belgium. fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter( 'country_lg == "Belgium"') print('Bounds of Belgium power plants:', fc.bounds().getInfo()) # ee.Geometry