Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain Earth Engine access.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["\u003cp\u003e\u003ccode\u003eaggregate_array\u003c/code\u003e compiles a list of all values for a specified property within an ImageCollection.\u003c/p\u003e\n"],["\u003cp\u003eThis function is applied to an ImageCollection and requires the property name as input.\u003c/p\u003e\n"],["\u003cp\u003eIt returns a list of all the values of the specified property across all images in the collection.\u003c/p\u003e\n"],["\u003cp\u003eUseful for analyzing the distribution and range of property values within a collection.\u003c/p\u003e\n"]]],[],null,["Aggregates over a given property of the objects in a collection, calculating a list of all the values of the selected property.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------------------------------|---------|\n| ImageCollection.aggregate_array`(property)` | List |\n\n| Argument | Type | Details |\n|--------------------|-------------------|----------------------------------------------------------|\n| this: `collection` | FeatureCollection | The collection to aggregate over. |\n| `property` | String | The property to use from each element of the collection. |\n\nExamples\n\nCode Editor (JavaScript) \n\n```javascript\n// A Lansat 8 TOA image collection for a specific year and location.\nvar col = ee.ImageCollection(\"LANDSAT/LC08/C02/T1_TOA\")\n .filterBounds(ee.Geometry.Point([-122.073, 37.188]))\n .filterDate('2018', '2019');\n\n// An image property of interest, percent cloud cover in this case.\nvar prop = 'CLOUD_COVER';\n\n// Use ee.ImageCollection.aggregate_* functions to fetch information about\n// values of a selected property across all images in the collection. For\n// example, produce a list of all values, get counts, and calculate statistics.\nprint('List of property values', col.aggregate_array(prop));\nprint('Count of property values', col.aggregate_count(prop));\nprint('Count of distinct property values', col.aggregate_count_distinct(prop));\nprint('First collection element property value', col.aggregate_first(prop));\nprint('Histogram of property values', col.aggregate_histogram(prop));\nprint('Min of property values', col.aggregate_min(prop));\nprint('Max of property values', col.aggregate_max(prop));\n\n// The following methods are applicable to numerical properties only.\nprint('Mean of property values', col.aggregate_mean(prop));\nprint('Sum of property values', col.aggregate_sum(prop));\nprint('Product of property values', col.aggregate_product(prop));\nprint('Std dev (sample) of property values', col.aggregate_sample_sd(prop));\nprint('Variance (sample) of property values', col.aggregate_sample_var(prop));\nprint('Std dev (total) of property values', col.aggregate_total_sd(prop));\nprint('Variance (total) of property values', col.aggregate_total_var(prop));\nprint('Summary stats of property values', col.aggregate_stats(prop));\n\n// Note that if the property is formatted as a string, min and max will\n// respectively return the first and last values according to alphanumeric\n// order of the property values.\nvar propString = 'LANDSAT_SCENE_ID';\nprint('List of property values (string)', col.aggregate_array(propString));\nprint('Min of property values (string)', col.aggregate_min(propString));\nprint('Max of property values (string)', col.aggregate_max(propString));\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\nColab (Python) \n\n```python\nfrom pprint import pprint\n\n# A Lansat 8 TOA image collection for a specific year and location.\ncol = ee.ImageCollection(\"LANDSAT/LC08/C02/T1_TOA\").filterBounds(\n ee.Geometry.Point([-122.073, 37.188])).filterDate('2018', '2019')\n\n# An image property of interest, percent cloud cover in this case.\nprop = 'CLOUD_COVER'\n\n# Use ee.ImageCollection.aggregate_* functions to fetch information about\n# values of a selected property across all images in the collection. For\n# example, produce a list of all values, get counts, and calculate statistics.\nprint('List of property values:', col.aggregate_array(prop).getInfo())\nprint('Count of property values:', col.aggregate_count(prop).getInfo())\nprint('Count of distinct property values:',\n col.aggregate_count_distinct(prop).getInfo())\nprint('First collection element property value:',\n col.aggregate_first(prop).getInfo())\nprint('Histogram of property values:')\npprint(col.aggregate_histogram(prop).getInfo())\nprint('Min of property values:', col.aggregate_min(prop).getInfo())\nprint('Max of property values:', col.aggregate_max(prop).getInfo())\n\n# The following methods are applicable to numerical properties only.\nprint('Mean of property values:',\n col.aggregate_mean(prop).getInfo())\nprint('Sum of property values:',\n col.aggregate_sum(prop).getInfo())\nprint('Product of property values:',\n col.aggregate_product(prop).getInfo())\nprint('Std dev (sample) of property values:',\n col.aggregate_sample_sd(prop).getInfo())\nprint('Variance (sample) of property values:',\n col.aggregate_sample_var(prop).getInfo())\nprint('Std dev (total) of property values:',\n col.aggregate_total_sd(prop).getInfo())\nprint('Variance (total) of property values:',\n col.aggregate_total_var(prop).getInfo())\nprint('Summary stats of property values:')\npprint(col.aggregate_stats(prop).getInfo())\n\n# Note that if the property is formatted as a string, min and max will\n# respectively return the first and last values according to alphanumeric\n# order of the property values.\nprop_string = 'LANDSAT_SCENE_ID'\nprint('List of property values (string):',\n col.aggregate_array(prop_string).getInfo())\nprint('Min of property values (string):',\n col.aggregate_min(prop_string).getInfo())\nprint('Max of property values (string):',\n col.aggregate_max(prop_string).getInfo())\n```"]]