公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.Image.where
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
根据条件替换值。
对于“input”中每个波段的每个像素,如果“test”中对应的像素不为零,则输出相应像素的值,否则输出输入像素。
如果给定像素的测试或值被遮盖,则使用输入值。如果输入被遮盖,则不执行任何操作。
输出波段与输入波段具有相同的名称。每个频段的输出类型是输入类型和值类型中较大的类型。输出图片会保留输入图片的元数据和覆盖区。
用法 | 返回 |
---|
Image.where(test, value) | 图片 |
参数 | 类型 | 详细信息 |
---|
此:input | 图片 | 输入图片。 |
test | 图片 | 测试图片。此图片的像素决定了返回哪些输入像素。如果这是单波段,则会用于输入图片中的所有波段。这可能不是数组图片。 |
value | 图片 | 在测试结果不为零时使用的输出值。如果这是单波段,则会用于输入图片中的所有波段。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eReplaces input image pixel values with values from a secondary image based on a test image's pixel values.\u003c/p\u003e\n"],["\u003cp\u003eIf the test image pixel is non-zero, the corresponding pixel from the value image is used; otherwise, the original input pixel is retained.\u003c/p\u003e\n"],["\u003cp\u003eInput image metadata and footprint are preserved in the output image.\u003c/p\u003e\n"],["\u003cp\u003eOutput image band types are determined by the larger type between the input and value images.\u003c/p\u003e\n"],["\u003cp\u003eMasked pixels in either test or value images result in the original input pixel being used in the output.\u003c/p\u003e\n"]]],[],null,["# ee.Image.where\n\nPerforms conditional replacement of values.\n\n\u003cbr /\u003e\n\nFor each pixel in each band of 'input', if the corresponding pixel in 'test' is nonzero, output the corresponding pixel in value, otherwise output the input pixel.\n\nIf at a given pixel, either test or value is masked, the input value is used. If the input is masked, nothing is done.\n\nThe output bands have the same names as the input bands. The output type of each band is the larger of the input and value types. The output image retains the metadata and footprint of the input image.\n\n| Usage | Returns |\n|----------------------------|---------|\n| Image.where`(test, value)` | Image |\n\n| Argument | Type | Details |\n|---------------|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `input` | Image | The input image. |\n| `test` | Image | The test image. The pixels of this image determines which of the input pixels is returned. If this is a single band, it is used for all bands in the input image. This may not be an array image. |\n| `value` | Image | The output value to use where test is not zero. If this is a single band, it is used for all bands in the input image. |"]]