ee.FeatureCollection.getNumber
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trích xuất một thuộc tính từ một đối tượng.
Cách sử dụng | Giá trị trả về |
---|
FeatureCollection.getNumber(property) | Số |
Đối số | Loại | Thông tin chi tiết |
---|
this: object | Phần tử | Tính năng để trích xuất thuộc tính. |
property | Chuỗi | Thuộc tính cần trích xuất. |
Ví dụ
Trình soạn thảo mã (JavaScript)
// A FeatureCollection with a number property value.
var fc = ee.FeatureCollection([]).set('number_property', 1.5);
// Fetch the number property value as an ee.Number object.
print('Number property value as ee.Number', fc.getNumber('number_property'));
Thiết lập Python
Hãy xem trang
Môi trường Python để biết thông tin về API Python và cách sử dụng geemap
cho quá trình phát triển tương tác.
import ee
import geemap.core as geemap
Colab (Python)
# A FeatureCollection with a number property value.
fc = ee.FeatureCollection([]).set('number_property', 1.5)
# Fetch the number property value as an ee.Number object.
print('Number property value as ee.Number:',
fc.getNumber('number_property').getInfo())
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eThe \u003ccode\u003egetNumber()\u003c/code\u003e method extracts a numerical property from an Earth Engine FeatureCollection.\u003c/p\u003e\n"],["\u003cp\u003eIt takes the property name as an argument and returns the property value as an ee.Number object.\u003c/p\u003e\n"],["\u003cp\u003eThis method is useful for accessing specific numerical data stored within a FeatureCollection's properties.\u003c/p\u003e\n"]]],[],null,["# ee.FeatureCollection.getNumber\n\nExtract a property from a feature.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------|---------|\n| FeatureCollection.getNumber`(property)` | Number |\n\n| Argument | Type | Details |\n|----------------|---------|-------------------------------------------|\n| this: `object` | Element | The feature to extract the property from. |\n| `property` | String | The property to extract. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A FeatureCollection with a number property value.\nvar fc = ee.FeatureCollection([]).set('number_property', 1.5);\n\n// Fetch the number property value as an ee.Number object.\nprint('Number property value as ee.Number', fc.getNumber('number_property'));\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# A FeatureCollection with a number property value.\nfc = ee.FeatureCollection([]).set('number_property', 1.5)\n\n# Fetch the number property value as an ee.Number object.\nprint('Number property value as ee.Number:',\n fc.getNumber('number_property').getInfo())\n```"]]