Stay organized with collections
Save and categorize content based on your preferences.
Samples the pixels of an image, returning them as a FeatureCollection. Each feature will have 1 property per band in the input image. Note that the default behavior is to drop features that intersect masked pixels, which result in null-valued properties (see dropNulls argument).
The region to sample from. If unspecified, uses the image's whole footprint.
scale
Float, default: null
A nominal scale in meters of the projection to sample in.
projection
Projection, 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.
factor
Float, default: null
A subsampling factor, within (0, 1]. If specified, 'numPixels' must not be specified. Defaults to no subsampling.
numPixels
Long, default: null
The approximate number of pixels to sample. If specified, 'factor' must not be specified.
seed
Integer, default: 0
A randomization seed to use for subsampling.
dropNulls
Boolean, default: true
Post filter the result to drop features that have null-valued properties.
tileScale
Float, 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.
geometries
Boolean, default: false
If true, adds the center of the sampled pixel as the geometry property of the output feature. Otherwise, geometries will be omitted (saving memory).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-13 UTC."],[[["`Image.sample()` extracts pixel values from an image and converts them into a FeatureCollection, with each feature representing a pixel and its properties corresponding to the band values."],["You can define a region of interest, control the sampling scale and projection, and adjust the number of sampled pixels using arguments like `region`, `scale`, `projection`, `factor`, and `numPixels`."],["Sampled features can optionally include point geometries representing pixel centers using the `geometries` argument."],["By default, features associated with masked pixels (resulting in null-valued properties) are excluded, which can be controlled using the `dropNulls` argument."]]],[]]