[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eMethods for accessing feature collection metadata are identical to those used for image collections, as detailed in the ImageCollection Information and Metadata section.\u003c/p\u003e\n"],["\u003cp\u003eYou can utilize aggregation methods to calculate statistics like feature count or attribute summaries within a feature collection.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code examples demonstrate how to obtain column information, including names and data types, from feature collections, which is particularly useful for filtering and analysis.\u003c/p\u003e\n"],["\u003cp\u003eComputed collections might not always possess column information within their metadata, as it's mainly available for collections from the Data Catalog or stored as assets.\u003c/p\u003e\n"],["\u003cp\u003eFor comprehensive feature collection reduction and analysis, refer to the Reducing a FeatureCollection page for more advanced aggregation tools.\u003c/p\u003e\n"]]],[],null,["# FeatureCollection Information and Metadata\n\nMethods for getting information from feature collection metadata are the same as\nthose for image collections. See the [ImageCollection Information and\nMetadata section](/earth-engine/guides/ic_info) for details.\n\nMetadata aggregation\n--------------------\n\nYou can use the aggregation shortcuts to count the number of features or summarize an attribute:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load watersheds from a data table.\nvar sheds = ee.FeatureCollection('USGS/WBD/2017/HUC06')\n // Filter to the continental US.\n .filterBounds(ee.Geometry.Rectangle(-127.18, 19.39, -62.75, 51.29))\n // Convert 'areasqkm' property from string to number.\n .map(function(feature){\n var num = ee.Number.parse(feature.get('areasqkm'));\n return feature.set('areasqkm', num);\n });\n\n// Display the table and print its first element.\nMap.addLayer(sheds, {}, 'watersheds');\nprint('First watershed', sheds.first());\n\n// Print the number of watersheds.\nprint('Count:', sheds.size());\n\n// Print stats for an area property.\nprint('Area stats:', sheds.aggregate_stats('areasqkm'));\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\n# Load watersheds from a data table.\nsheds = (\n ee.FeatureCollection('USGS/WBD/2017/HUC06')\n # Filter to the continental US.\n .filterBounds(ee.Geometry.Rectangle(-127.18, 19.39, -62.75, 51.29))\n # Convert 'areasqkm' property from string to number.\n .map(\n lambda feature: feature.set(\n 'areasqkm', ee.Number.parse(feature.get('areasqkm'))\n )\n )\n)\n\n# Display the table and print its first element.\nm = geemap.Map()\nm.add_layer(sheds, {}, 'watersheds')\ndisplay(m)\ndisplay('First watershed:', sheds.first())\n\n# Print the number of watersheds.\ndisplay('Count:', sheds.size())\n\n# Print stats for an area property.\ndisplay('Area stats:', sheds.aggregate_stats('areasqkm'))\n```\n\nColumn information\n------------------\n\nKnowing the names and dataypes of `FeatureCollection` columns can be helpful (e.g., [filtering a\ncollection by metadata](/earth-engine/guides/feature_collection_filtering)). The following example prints column names\nand datatypes for a collection of point features representing protected areas.\n\n### Code Editor (JavaScript)\n\n```javascript\n// Import a protected areas point feature collection.\nvar wdpa = ee.FeatureCollection(\"WCMC/WDPA/current/points\");\n\n// Define a function to print metadata column names and datatypes. This function\n// is intended to be applied by the `evaluate` method which provides the\n// function a client-side dictionary allowing the 'columns' object of the\n// feature collection metadata to be subset by dot notation or bracket notation\n// (`tableMetadata['columns']`).\nfunction getCols(tableMetadata) {\n print(tableMetadata.columns);\n}\n\n// Fetch collection metadata (`.limit(0)`) and apply the\n// previously defined function using `evaluate()`. The printed object is a\n// dictionary where keys are column names and values are datatypes.\nwdpa.limit(0).evaluate(getCols);\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\n# Import a protected areas point feature collection.\nwdpa = ee.FeatureCollection('WCMC/WDPA/current/points')\n\n# Fetch collection metadata (`.limit(0)`). The printed object is a\n# dictionary where keys are column names and values are datatypes.\nwdpa.limit(0).getInfo()['columns']\n```\n| **Note:** Computed collections may not have column information available as part of the collection metadata. Metadata exists for collections within the Data Catalog and those stored as assets. During some operations, however, metadata can be lost (joins, mapping, etc.). Additionally, collections not retrieved from disk (\"computed collections\", like those derived from lists or `reduceRegions()`) may lack meaningful type information.\n\nFor more general purpose `FeatureCollection` aggregation tools, see the\n[Reducing a FeatureCollection](/earth-engine/guides/feature_collection_reducing) page."]]