pixelArea#
- classmethod geetools.ee_image.ImageAccessor.pixelArea(area_unit='m2', rename_to_units=False)#
Extend the :py:method:`ee.Image.pixelArea` method by setting the unit of the output.
- Parameters:
- Returns:
the area
ee.Imageusing the given unit.- Return type:
Examples
import ee, geetools from geetools.utils import initialize_documentation initialize_documentation() hectares = ee.Image.geetools.pixelArea("ha").rename("ha") acres = ee.Image.geetools.pixelArea("acres").rename("acres") total = hectares.addBands(acres) buffer = ee.Geometry.Point(0,0).buffer(100) values = total.reduceRegion(ee.Reducer.mean(), buffer, 1) values.getInfo()
{'acres': 0.0002454509480267026, 'ha': 9.933056235313415e-05}