Объявление : Все некоммерческие проекты, зарегистрированные для использования Earth Engine до
15 апреля 2025 года, должны
подтвердить некоммерческое право на сохранение доступа к Earth Engine.
ee.FeatureCollection.makeArray
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Добавьте одномерный массив к каждому объекту в коллекции, объединив список свойств каждого объекта в одномерный массив. Все свойства должны быть числовыми значениями. Если объект не содержит всех указанных свойств или какое-либо из них не является числовым, он будет удален из результирующей коллекции.
Использование | Возврат | FeatureCollection. makeArray (properties, name ) | FeatureCollection |
Аргумент | Тип | Подробности | это: collection | FeatureCollection | Входная коллекция, из которой будут выбраны свойства. |
properties | Список | Свойства для выбора. |
name | Строка, по умолчанию: "array" | Имя нового свойства массива. |
Примеры
Редактор кода (JavaScript)
// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
.filter('country_lg == "Belgium"');
// A list of feature properties to combine into an array
// (power generation by year).
var properties = ['gwh_2013', 'gwh_2014', 'gwh_2015', 'gwh_2016'];
// Add array of power-generation-by-year property to features.
fc = fc.makeArray(properties, 'gwh_by_year');
print('FeatureCollection with array of selected properties added', fc);
print('See example of new "gwh_by_year" property', fc.first().toDictionary());
Настройка Python
Информацию об API Python и использовании geemap
для интерактивной разработки см. на странице «Среда Python» .
import ee
import geemap.core as geemap
Colab (Python)
from pprint import pprint
# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
'country_lg == "Belgium"')
# A list of feature properties to combine into an array
# (power generation by year).
properties = ['gwh_2013', 'gwh_2014', 'gwh_2015', 'gwh_2016']
# Add array of power-generation-by-year property to features.
fc = fc.makeArray(properties, 'gwh_by_year')
print('FeatureCollection with array of selected properties added:',
fc.getInfo())
print('See example of new "gwh_by_year" property:')
pprint(fc.first().toDictionary().getInfo())
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-07-24 UTC.
[null,null,["Последнее обновление: 2025-07-24 UTC."],[[["\u003cp\u003e\u003ccode\u003emakeArray()\u003c/code\u003e combines specified numeric properties of features within a FeatureCollection into a new 1-D array property.\u003c/p\u003e\n"],["\u003cp\u003eFeatures lacking any of the specified properties, or containing non-numeric values in those properties, are excluded from the output.\u003c/p\u003e\n"],["\u003cp\u003eThe resulting FeatureCollection contains the original features with an added array property holding the combined values.\u003c/p\u003e\n"],["\u003cp\u003eThe array property is named using the 'name' argument, defaulting to "array" if not provided.\u003c/p\u003e\n"]]],[],null,["# ee.FeatureCollection.makeArray\n\nAdd a 1-D Array to each feature in a collection by combining a list of properties for each feature into a 1-D Array. All of the properties must be numeric values. If a feature doesn't contain all of the named properties, or any of them aren't numeric, the feature will be dropped from the resulting collection.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------------------|-------------------|\n| FeatureCollection.makeArray`(properties, `*name*`)` | FeatureCollection |\n\n| Argument | Type | Details |\n|--------------------|--------------------------|--------------------------------------------------------------|\n| this: `collection` | FeatureCollection | The input collection from which properties will be selected. |\n| `properties` | List | The properties to select. |\n| `name` | String, default: \"array\" | The name of the new array property. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// FeatureCollection of power plants in Belgium.\nvar fc = ee.FeatureCollection('WRI/GPPD/power_plants')\n .filter('country_lg == \"Belgium\"');\n\n// A list of feature properties to combine into an array\n// (power generation by year).\nvar properties = ['gwh_2013', 'gwh_2014', 'gwh_2015', 'gwh_2016'];\n\n// Add array of power-generation-by-year property to features.\nfc = fc.makeArray(properties, 'gwh_by_year');\n\nprint('FeatureCollection with array of selected properties added', fc);\nprint('See example of new \"gwh_by_year\" property', fc.first().toDictionary());\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\nfrom pprint import pprint\n\n# FeatureCollection of power plants in Belgium.\nfc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(\n 'country_lg == \"Belgium\"')\n\n# A list of feature properties to combine into an array\n# (power generation by year).\nproperties = ['gwh_2013', 'gwh_2014', 'gwh_2015', 'gwh_2016']\n\n# Add array of power-generation-by-year property to features.\nfc = fc.makeArray(properties, 'gwh_by_year')\n\nprint('FeatureCollection with array of selected properties added:',\n fc.getInfo())\nprint('See example of new \"gwh_by_year\" property:')\npprint(fc.first().toDictionary().getInfo())\n```"]]