公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.DateRange.intersection
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
返回一个 DateRange,其中包含此 DateRange 与另一个 DateRange 的交集中的所有点。
用法 | 返回 |
---|
DateRange.intersection(other) | DateRange |
参数 | 类型 | 详细信息 |
---|
此:dateRange | DateRange | |
other | DateRange | |
示例
代码编辑器 (JavaScript)
// A series of ee.DateRange objects.
var dateRange1 = ee.DateRange('2017-06-24', '2017-07-24');
var dateRange2 = ee.DateRange('2017-07-01', '2018-08-24');
// Determine the intersection of two ee.DateRange objects.
print('Intersection of dateRange1 and dateRange2',
dateRange1.intersection(dateRange2));
Python 设置
如需了解 Python API 和如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
# A series of ee.DateRange objects.
date_range_1 = ee.DateRange('2017-06-24', '2017-07-24')
date_range_2 = ee.DateRange('2017-07-01', '2018-08-24')
# Determine the intersection of two ee.DateRange objects.
display(
'Intersection of date_range_1 and date_range_2:',
date_range_1.intersection(date_range_2)
)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003eDateRange.intersection()\u003c/code\u003e returns a new \u003ccode\u003eDateRange\u003c/code\u003e representing the overlapping period between two \u003ccode\u003eDateRange\u003c/code\u003e objects.\u003c/p\u003e\n"],["\u003cp\u003eThis function takes another \u003ccode\u003eDateRange\u003c/code\u003e as an argument and determines the common time span between the two.\u003c/p\u003e\n"],["\u003cp\u003eYou can use this function to identify the period where both date ranges coincide for further analysis or filtering.\u003c/p\u003e\n"],["\u003cp\u003eCode examples are provided in JavaScript, Python, and Colab demonstrating how to use \u003ccode\u003eDateRange.intersection()\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `intersection()` method determines the overlapping period between two `DateRange` objects. It takes another `DateRange` as input (`other`). The method returns a new `DateRange` that represents the shared time interval between the original `DateRange` and the input `DateRange`. For example, intersecting '2017-06-24' to '2017-07-24' with '2017-07-01' to '2018-08-24' yields a DateRange from '2017-07-01' to '2017-07-24'.\n"],null,["# ee.DateRange.intersection\n\nReturns a DateRange that contains all points in the intersection of this DateRange and another.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------------------|-----------|\n| DateRange.intersection`(other)` | DateRange |\n\n| Argument | Type | Details |\n|-------------------|-----------|---------|\n| this: `dateRange` | DateRange | |\n| `other` | DateRange | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A series of ee.DateRange objects.\nvar dateRange1 = ee.DateRange('2017-06-24', '2017-07-24');\nvar dateRange2 = ee.DateRange('2017-07-01', '2018-08-24');\n\n// Determine the intersection of two ee.DateRange objects.\nprint('Intersection of dateRange1 and dateRange2',\n dateRange1.intersection(dateRange2));\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 series of ee.DateRange objects.\ndate_range_1 = ee.DateRange('2017-06-24', '2017-07-24')\ndate_range_2 = ee.DateRange('2017-07-01', '2018-08-24')\n\n# Determine the intersection of two ee.DateRange objects.\ndisplay(\n 'Intersection of date_range_1 and date_range_2:',\n date_range_1.intersection(date_range_2)\n)\n```"]]