Announcement: All noncommercial projects registered to use Earth Engine beforeApril 15, 2025 mustverify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.

ee.Array.bitwiseOr

  • TheArray.bitwiseOr method calculates the bitwise OR of two input arrays on an element-wise basis.

  • The method returns an array as the result.

  • Both the left-hand (this) and right-hand (right) values are arrays.

  • The examples demonstrate the bitwise OR operation with various integer inputs, including positive, negative, and hexadecimal values.

On an element-wise basis, calculates the bitwise OR of the input values.

UsageReturns
Array.bitwiseOr(right)Array
ArgumentTypeDetails
this:leftArrayThe left-hand value.
rightArrayThe right-hand value.

Examples

Code Editor (JavaScript)

varempty=ee.Array([],ee.PixelType.int8());print(empty.bitwiseOr(empty));// []print(ee.Array(0).bitwiseOr(ee.Array(0)));// 0print(ee.Array(0).bitwiseOr(ee.Array(1)));// 1print(ee.Array(1).bitwiseOr(ee.Array(0)));// 1print(ee.Array(1).bitwiseOr(ee.Array(1)));// 1print(ee.Array(0xFF).bitwiseOr(ee.Array(0xFFFF)));// 65535print(ee.Array(0xFFFF).bitwiseOr(ee.Array(0xFF)));// 65535print(ee.Array(-1).bitwiseOr(ee.Array(0xFF)));// -1print(ee.Array(-2).bitwiseOr(ee.Array(-3)));// -1print(ee.Array(-2).bitwiseOr(ee.Array(-4)));// -2print(ee.Array([6,6]).bitwiseOr(ee.Array([1,11])));// [7,15]

Python setup

See the Python Environment page for information on the Python API and usinggeemap for interactive development.

importeeimportgeemap.coreasgeemap

Colab (Python)

empty=ee.Array([],ee.PixelType.int8())display(empty.bitwiseOr(empty))# []display(ee.Array(0).bitwiseOr(ee.Array(0)))# 0display(ee.Array(0).bitwiseOr(ee.Array(1)))# 1display(ee.Array(1).bitwiseOr(ee.Array(0)))# 1display(ee.Array(1).bitwiseOr(ee.Array(1)))# 1display(ee.Array(0xFF).bitwiseOr(ee.Array(0xFFFF)))# 65535display(ee.Array(0xFFFF).bitwiseOr(ee.Array(0xFF)))# 65535display(ee.Array(-1).bitwiseOr(ee.Array(0xFF)))# -1display(ee.Array(-2).bitwiseOr(ee.Array(-3)))# -1display(ee.Array(-2).bitwiseOr(ee.Array(-4)))# -2display(ee.Array([6,6]).bitwiseOr(ee.Array([1,11])))# [7, 15]

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-10-06 UTC.