Anuncio: Todos los proyectos no comerciales registrados para usar Earth Engine antes del
15 de abril de 2025 deben
verificar su elegibilidad no comercial para mantener el acceso a Earth Engine.
ee.List.add
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Agrega el elemento al final de la lista.
Uso | Muestra |
---|
List.add(element) | Lista |
Argumento | Tipo | Detalles |
---|
esta: list | Lista | |
element | Objeto | |
Ejemplos
Editor de código (JavaScript)
print(ee.List([]).add('b')); // ["b"]
print(ee.List(['a']).add('b')); // ["a","b"]
print(ee.List(['a']).add(ee.String('b'))); // ["a","b"]
print(ee.List(['a']).add(1)); // ["a",1]
print(ee.List(['a']).add(ee.Number(1))); // ["a",1]
print(ee.List(['a']).add(true)); // ["a",true]
print(ee.List(['a']).add([])); // ["a",[]]
print(ee.List(['a']).add(ee.List([]))); // ["a",[]]
print(ee.List(['a']).add(['b'])); // ["a",["b"]]
print(ee.List(['a']).add(ee.List(['b']))); // ["a",["b"]]
print(ee.List(['a']).add(ee.Dictionary())); // ["a",{}]
print(ee.List(['a']).add(ee.Dictionary({b: 'c'}))); // ["a",{"b":"c"}]
// 0: a
// 1: Image (1 band)
print(ee.List(['a']).add(ee.Image.constant(1)));
// ["a",{"type":"ImageCollection","bands":[]}]
print(ee.List(['a']).add(ee.ImageCollection([])));
Configuración de Python
Consulta la página
Entorno de Python para obtener información sobre la API de Python y el uso de geemap
para el desarrollo interactivo.
import ee
import geemap.core as geemap
Colab (Python)
print(ee.List([]).add('b').getInfo()) # ['b']
print(ee.List(['a']).add('b').getInfo()) # ['a', 'b']
print(ee.List(['a']).add(ee.String('b')).getInfo()) # ['a', 'b']
print(ee.List(['a']).add(1).getInfo()) # ['a', 1]
print(ee.List(['a']).add(ee.Number(1)).getInfo()) # ['a', 1]
print(ee.List(['a']).add(True).getInfo()) # ['a', True]
print(ee.List(['a']).add([]).getInfo()) # ['a', []]
print(ee.List(['a']).add(ee.List([])).getInfo()) # ['a', []]
print(ee.List(['a']).add(['b']).getInfo()) # ['a', ['b']]
print(ee.List(['a']).add(ee.List(['b'])).getInfo()) # ['a', ['b']]
print(ee.List(['a']).add(ee.Dictionary()).getInfo()) # ['a', {}]
# ['a', {'b': 'c'}]
print(ee.List(['a']).add(ee.Dictionary({'b': 'c'})).getInfo())
# 0: a
# 1: Image (1 band)
print(ee.List(['a']).add(ee.Image.constant(1)).getInfo())
# ["a", {"type":"ImageCollection", "bands":[]}]
print(ee.List(['a']).add(ee.ImageCollection([])).getInfo())
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
[null,null,["Última actualización: 2025-07-26 (UTC)"],[[["\u003cp\u003e\u003ccode\u003eList.add()\u003c/code\u003e appends an element to the end of a list and returns the modified list.\u003c/p\u003e\n"],["\u003cp\u003eThe method accepts any object as the element to be added.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eList.add()\u003c/code\u003e can be chained with other list methods for more complex operations.\u003c/p\u003e\n"],["\u003cp\u003eThe original list is not modified; a new list with the added element is returned.\u003c/p\u003e\n"]]],["The `List.add(element)` function appends an element to the end of a list. It takes an object as an argument (`element`), which can be any data type. The function modifies the list by adding the provided element at the end. It returns the modified list. The examples show different elements added to a list, including strings, numbers, booleans, empty lists, and even more complex data structures like dictionaries, images, and image collections.\n"],null,["# ee.List.add\n\nAppends the element to the end of list.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------|---------|\n| List.add`(element)` | List |\n\n| Argument | Type | Details |\n|--------------|--------|---------|\n| this: `list` | List | |\n| `element` | Object | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nprint(ee.List([]).add('b')); // [\"b\"]\nprint(ee.List(['a']).add('b')); // [\"a\",\"b\"]\nprint(ee.List(['a']).add(ee.String('b'))); // [\"a\",\"b\"]\n\nprint(ee.List(['a']).add(1)); // [\"a\",1]\nprint(ee.List(['a']).add(ee.Number(1))); // [\"a\",1]\n\nprint(ee.List(['a']).add(true)); // [\"a\",true]\n\nprint(ee.List(['a']).add([])); // [\"a\",[]]\nprint(ee.List(['a']).add(ee.List([]))); // [\"a\",[]]\nprint(ee.List(['a']).add(['b'])); // [\"a\",[\"b\"]]\nprint(ee.List(['a']).add(ee.List(['b']))); // [\"a\",[\"b\"]]\n\nprint(ee.List(['a']).add(ee.Dictionary())); // [\"a\",{}]\nprint(ee.List(['a']).add(ee.Dictionary({b: 'c'}))); // [\"a\",{\"b\":\"c\"}]\n\n// 0: a\n// 1: Image (1 band)\nprint(ee.List(['a']).add(ee.Image.constant(1)));\n\n// [\"a\",{\"type\":\"ImageCollection\",\"bands\":[]}]\nprint(ee.List(['a']).add(ee.ImageCollection([])));\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\nprint(ee.List([]).add('b').getInfo()) # ['b']\nprint(ee.List(['a']).add('b').getInfo()) # ['a', 'b']\nprint(ee.List(['a']).add(ee.String('b')).getInfo()) # ['a', 'b']\n\nprint(ee.List(['a']).add(1).getInfo()) # ['a', 1]\nprint(ee.List(['a']).add(ee.Number(1)).getInfo()) # ['a', 1]\n\nprint(ee.List(['a']).add(True).getInfo()) # ['a', True]\n\nprint(ee.List(['a']).add([]).getInfo()) # ['a', []]\nprint(ee.List(['a']).add(ee.List([])).getInfo()) # ['a', []]\nprint(ee.List(['a']).add(['b']).getInfo()) # ['a', ['b']]\nprint(ee.List(['a']).add(ee.List(['b'])).getInfo()) # ['a', ['b']]\n\nprint(ee.List(['a']).add(ee.Dictionary()).getInfo()) # ['a', {}]\n\n# ['a', {'b': 'c'}]\nprint(ee.List(['a']).add(ee.Dictionary({'b': 'c'})).getInfo())\n\n# 0: a\n# 1: Image (1 band)\nprint(ee.List(['a']).add(ee.Image.constant(1)).getInfo())\n\n# [\"a\", {\"type\":\"ImageCollection\", \"bands\":[]}]\nprint(ee.List(['a']).add(ee.ImageCollection([])).getInfo())\n```"]]