ee.Image.where
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Führt einen bedingten Ersatz von Werten durch.
Für jedes Pixel in jedem Band von „input“: Wenn das entsprechende Pixel in „test“ ungleich null ist, wird das entsprechende Pixel in „value“ ausgegeben, andernfalls das Eingabepixel.
Wenn für ein bestimmtes Pixel entweder der Test oder der Wert maskiert ist, wird der Eingabewert verwendet. Wenn die Eingabe maskiert ist, wird nichts unternommen.
Die Ausgabebänder haben dieselben Namen wie die Eingabebänder. Der Ausgabetyp jedes Bands ist der größere der Eingabe- und Werttypen. Das Ausgabebild behält die Metadaten und den Footprint des Eingabebilds bei.
Nutzung | Ausgabe |
---|
Image.where(test, value) | Bild |
Argument | Typ | Details |
---|
So gehts: input | Bild | Das Eingabebild. |
test | Bild | Das Testbild. Die Pixel dieses Bildes bestimmen, welche der Eingabepixel zurückgegeben werden. Wenn es sich um ein einzelnes Band handelt, wird es für alle Bänder im Eingabebild verwendet. Das ist möglicherweise kein Array-Bild. |
value | Bild | Der Ausgabewert, der verwendet werden soll, wenn der Testwert ungleich null ist. Wenn es sich um ein einzelnes Band handelt, wird es für alle Bänder im Eingabebild verwendet. |
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-07-26 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[[["\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. |"]]