geetools.ImageAccessor.clipOnCollection#

geetools.ImageAccessor.clipOnCollection(fc, keepProperties=1)#

Clip an image to a FeatureCollection.

The image will be clipped to every single features of the featureCollection as one independent image.

Parameters:
  • fc (ee.FeatureCollection) – The featureCollection to clip to.

  • keepProperties (geetools.types.ee_int) – If True, the properties of the featureCollection will be added to the clipped image.

Returns:

The clipped imageCollection.

Return type:

ee.ImageCollection

Examples

import ee, geetools

ee.Initialize()

src = 'COPERNICUS/S2_SR_HARMONIZED/20200101T100319_20200101T100321_T32TQM'
image = ee.Image(src)
fc = ee.FeatureCollection('FAO/GAUL/2015/level0')
clipped = image.geetools.clipOnCollection(fc)
print(clipped.size().getInfo())