ee.Array.identity Stay organized with collections Save and categorize content based on your preferences.
Page Summary
The
ee.Array.identity(size)method creates a 2D identity matrix of a specified size.The
sizeargument is an integer that determines the length of each axis of the matrix.The method returns an Earth Engine Array.
Examples demonstrate how to use
ee.Array.identityin JavaScript and Python, showing the output for various sizes including 0, 1, 2, and 3.
| Usage | Returns |
|---|---|
ee.Array.identity(size) | Array |
| Argument | Type | Details |
|---|---|---|
size | Integer | The length of each axis. |
Examples
Code Editor (JavaScript)
// []print(ee.Array.identity(0));// [[1]]print(ee.Array.identity(1));// [[1,0],// [0,1]]print(ee.Array.identity(2));// [[1,0,0],// [0,1,0],// [0,0,1]]print(ee.Array.identity(3));
Python setup
See the Python Environment page for information on the Python API and usinggeemap for interactive development.
importeeimportgeemap.coreasgeemap
Colab (Python)
# []display(ee.Array.identity(0))# [[1]]display(ee.Array.identity(1))# [[1, 0],# [0, 1]]display(ee.Array.identity(2))# [[1, 0, 0],# [0, 1, 0],# [0, 0, 1]]display(ee.Array.identity(3))
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.