Earth Engine 将推出
非商业配额层级,以保护共享计算资源并确保为所有人提供可靠的性能。所有非商业项目都需要在
2026 年 4 月 27 日之前选择配额层级,否则系统会默认使用 Community 层级。层级配额将于
2026 年 4 月 27 日对所有项目生效(无论层级选择日期如何)。
了解详情。
ee.Image.sampleRectangle
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
从图像中提取一个矩形像素区域,并按波段将其放入 ND 数组中。返回的数组位于一个保留了与图像相同属性的要素中,并且几何图形与用于对图像进行采样的几何图形(如果未指定,则为图像覆盖区)相同。每个波段都以其输入投影进行采样,如果未指定几何图形,则使用其覆盖区进行采样。对于标量波段,输出数组为二维数组。对于数组频段,输出数组为 (2+N) 维,其中 N 是原始频段中的维度数。如果对数组频段进行抽样,则所有数组必须具有相同数量的元素。如果某个频段的抽样区域完全被遮盖,并且指定了默认数组值,则使用默认数组值来代替对图片进行抽样。
| 用法 | 返回 |
|---|
Image.sampleRectangle(region, properties, defaultValue, defaultArrayValue) | 功能 |
| 参数 | 类型 | 详细信息 |
|---|
此:image | 图片 | 要抽样的图片。 |
region | 几何图形,默认值:null | 用于对图片进行采样的区域(其投影边界框)。默认为每个频段的覆盖范围。 |
properties | 列表,默认值:null | 要从抽样图片复制的属性。默认为所有非系统属性。 |
defaultValue | 浮点数,默认值:null | 当抽样的像素被遮盖或位于波段覆盖区之外时使用的默认值。 |
defaultArrayValue | 数组,默认值:null | 当采样数组像素被遮盖或位于频段覆盖区之外时使用的默认值。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[],["It extracts a rectangular pixel region from an image into an ND array per band, returning a feature with the same properties and geometry as the input. Bands are sampled in their input projection using a specified region or the image footprint. Output arrays are 2D for scalar bands and (2+N)D for array bands. If a sampled region is entirely masked, a specified default value or array is used. Properties from the image can be copied.\n"]]