公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.ErrorMargin
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
返回具有指定值和指定类型的 ErrorMargin。
用法 | 返回 |
---|
ee.ErrorMargin(value, unit) | ErrorMargin |
参数 | 类型 | 详细信息 |
---|
value | 浮点数,默认值:null | 边际允许的最大误差值。如果单位为“无限”,则忽略。 |
unit | 字符串,默认值:“meters” | 此边距的单位:“meters”(米)、“projected”(投影)或“infinite”(无限)。 |
示例
代码编辑器 (JavaScript)
// Construct a variety of error margins.
print(ee.ErrorMargin(0)); // unit: meters value: 0
print(ee.ErrorMargin(1)); // unit: meters value: 1
// Negative margin yields a positive value.
print(ee.ErrorMargin(-1)); // unit: meters value: 1
// Large values are turned into an 'infinite'
print(ee.ErrorMargin(1e8)); // unit: infinite
// A very large error margin does not quite trigger infinite, which is 2.0e7.
print(ee.ErrorMargin(1e7)); // unit: meters value: 10000000
// Being explicit about the units of the error margin.
print(ee.ErrorMargin(1, 'meters')); // unit: meters value: 1
print(ee.ErrorMargin(1, 'projected')); // unit: projected value: 1
print(ee.ErrorMargin(1, 'infinite')); // unit: infinite
Python 设置
如需了解 Python API 和如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
# Construct a variety of error margins.
print(ee.ErrorMargin(0).getInfo()) # unit: meters value: 0
print(ee.ErrorMargin(1).getInfo()) # unit: meters value: 1
# Negative margin yields a positive value.
print(ee.ErrorMargin(-1).getInfo()) # unit: meters value: 1
# Large values are turned into an 'infinite'
print(ee.ErrorMargin(1e8).getInfo()) # unit: infinite
# A very large error margin does not quite trigger infinite, which is 2.0e7.
print(ee.ErrorMargin(1e7).getInfo()) # unit: meters value: 10000000
# Being explicit about the units of the error margin.
print(ee.ErrorMargin(1, 'meters').getInfo()) # unit: meters value: 1
print(ee.ErrorMargin(1, 'projected').getInfo()) # unit: projected value: 1
print(ee.ErrorMargin(1, 'infinite').getInfo()) # unit: infinite
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003eee.ErrorMargin\u003c/code\u003e creates an object representing a margin of error for spatial operations.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts an optional \u003ccode\u003evalue\u003c/code\u003e (default: null) and \u003ccode\u003eunit\u003c/code\u003e (default: "meters") to define the margin.\u003c/p\u003e\n"],["\u003cp\u003eUnits can be 'meters', 'projected', or 'infinite', with large values (>= 2.0e7) automatically treated as 'infinite'.\u003c/p\u003e\n"],["\u003cp\u003eNegative values for \u003ccode\u003evalue\u003c/code\u003e are converted to positive values, representing the absolute error.\u003c/p\u003e\n"]]],[],null,["# ee.ErrorMargin\n\nReturns an ErrorMargin of the given type with the given value.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|----------------------------------------|-------------|\n| `ee.ErrorMargin(`*value* `, `*unit*`)` | ErrorMargin |\n\n| Argument | Type | Details |\n|----------|---------------------------|-----------------------------------------------------------------------------------|\n| `value` | Float, default: null | The maximum error value allowed by the margin. Ignored if the unit is 'infinite'. |\n| `unit` | String, default: \"meters\" | The unit of this margin: 'meters', 'projected' or 'infinite'. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Construct a variety of error margins.\nprint(ee.ErrorMargin(0)); // unit: meters value: 0\nprint(ee.ErrorMargin(1)); // unit: meters value: 1\n// Negative margin yields a positive value.\nprint(ee.ErrorMargin(-1)); // unit: meters value: 1\n// Large values are turned into an 'infinite'\nprint(ee.ErrorMargin(1e8)); // unit: infinite\n// A very large error margin does not quite trigger infinite, which is 2.0e7.\nprint(ee.ErrorMargin(1e7)); // unit: meters value: 10000000\n\n// Being explicit about the units of the error margin.\nprint(ee.ErrorMargin(1, 'meters')); // unit: meters value: 1\nprint(ee.ErrorMargin(1, 'projected')); // unit: projected value: 1\nprint(ee.ErrorMargin(1, 'infinite')); // unit: infinite\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# Construct a variety of error margins.\nprint(ee.ErrorMargin(0).getInfo()) # unit: meters value: 0\nprint(ee.ErrorMargin(1).getInfo()) # unit: meters value: 1\n# Negative margin yields a positive value.\nprint(ee.ErrorMargin(-1).getInfo()) # unit: meters value: 1\n# Large values are turned into an 'infinite'\nprint(ee.ErrorMargin(1e8).getInfo()) # unit: infinite\n# A very large error margin does not quite trigger infinite, which is 2.0e7.\nprint(ee.ErrorMargin(1e7).getInfo()) # unit: meters value: 10000000\n\n# Being explicit about the units of the error margin.\nprint(ee.ErrorMargin(1, 'meters').getInfo()) # unit: meters value: 1\nprint(ee.ErrorMargin(1, 'projected').getInfo()) # unit: projected value: 1\nprint(ee.ErrorMargin(1, 'infinite').getInfo()) # unit: infinite\n```"]]