ee.Image.sampleRegions

Converts each pixel of an image (at a given scale) that intersects one or more regions to a Feature, returning them as a FeatureCollection. Each output feature will have one property per band of the input image, as well as any specified properties copied from the input feature.

Note that geometries will be snapped to pixel centers.

UsageReturns
Image.sampleRegions(collection, properties, scale, projection, tileScale, geometries)FeatureCollection
ArgumentTypeDetails
this: imageImage

The image to sample.

collectionFeatureCollection

The regions to sample over.

propertiesList, default: null

The list of properties to copy from each input feature. Defaults to all non-system properties.

scaleFloat, default: null

A nominal scale in meters of the projection to sample in. If unspecified,the scale of the image's first band is used.

projectionProjection, default: null

The projection in which to sample. If unspecified, the projection of the image's first band is used. If specified in addition to scale, rescaled to the specified scale.

tileScaleFloat, default: 1

A scaling factor used to reduce aggregation tile size; using a larger tileScale (e.g. 2 or 4) may enable computations that run out of memory with the default.

geometriesBoolean, default: false

If true, the results will include a point geometry per sampled pixel. Otherwise, geometries will be omitted (saving memory).