Объявление : Все некоммерческие проекты, зарегистрированные для использования Earth Engine до
15 апреля 2025 года, должны
подтвердить некоммерческое право на сохранение доступа к Earth Engine.
ee.FeatureCollection.filterDate
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Ярлык для фильтрации коллекции по диапазону дат. Начальный и конечный периоды могут быть датами, числами (интерпретируемыми как миллисекунды с 1970-01-01T00:00:00Z) или строками (например, «1996-01-01T08:00»). Основано на «system:time_start».
Это эквивалентно this.filter(ee.Filter.date(...)); другие параметры фильтрации по дате см. в типе ee.Filter.
Возвращает отфильтрованную коллекцию.
Использование | Возврат | FeatureCollection. filterDate (start, end ) | Коллекция |
Аргумент | Тип | Подробности | это: collection | Коллекция | Экземпляр коллекции. |
start | Дата|Число|Строка | Дата начала (включительно). |
end | Дата|Число|Строка, необязательно | Дата окончания (не включая дату). Необязательно. Если не указано, создаётся диапазон длительностью 1 миллисекунда, начинающийся с «start». |
Примеры
Редактор кода (JavaScript)
// Constructed FeatureCollection representing a field site sampled at
// four different dates; date recorded as "system:time_start" property in units
// of milliseconds since Unix epoch.
var geom = ee.Geometry.Point([-119.56, 37.67]);
var fc = ee.FeatureCollection([
ee.Feature(geom, {'prop': 10, 'system:time_start': ee.Date('2021-06-10')}),
ee.Feature(geom, {'prop': 11, 'system:time_start': ee.Date('2021-06-20')}),
ee.Feature(geom, {'prop': 19, 'system:time_start': ee.Date('2021-07-10')}),
ee.Feature(geom, {'prop': 10, 'system:time_start': ee.Date('2021-07-20')})
]);
// Filter the observations in July 2021.
print('Field site observations collection in July 2021',
fc.filterDate('2021-07-01', '2021-08-01'));
// Alternative input formats.
print('ee.DateRange as an input',
fc.filterDate(ee.DateRange('2021-07-01', '2021-08-01')));
print('Numbers (milliseconds since Unix epoch) as an input',
fc.filterDate(1625875200000, 1626739200001));
print('ee.Date objects as an input',
fc.filterDate(ee.Date('2021-07-01'), ee.Date('2021-08-01')));
Настройка Python
Информацию об API Python и использовании geemap
для интерактивной разработки см. на странице «Среда Python» .
import ee
import geemap.core as geemap
Colab (Python)
# Constructed FeatureCollection representing a field site sampled at
# four different dates; date recorded as "system:time_start" property in units
# of milliseconds since Unix epoch.
geom = ee.Geometry.Point([-119.56, 37.67])
fc = ee.FeatureCollection([
ee.Feature(geom, {'prop': 10, 'system:time_start': ee.Date('2021-06-10')}),
ee.Feature(geom, {'prop': 11, 'system:time_start': ee.Date('2021-06-20')}),
ee.Feature(geom, {'prop': 19, 'system:time_start': ee.Date('2021-07-10')}),
ee.Feature(geom, {'prop': 10, 'system:time_start': ee.Date('2021-07-20')})
])
# Filter the observations in July 2021.
print('Field site observations collection in July 2021:',
fc.filterDate('2021-07-01', '2021-08-01').getInfo())
# Alternative input formats.
print('ee.DateRange as an input:',
fc.filterDate(ee.DateRange('2021-07-01', '2021-08-01')).getInfo())
print('Numbers (milliseconds since Unix epoch) as an input:',
fc.filterDate(1625875200000, 1626739200001).getInfo())
print('ee.Date objects as an input:',
fc.filterDate(ee.Date('2021-07-01'), ee.Date('2021-08-01')).getInfo())
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-07-24 UTC.
[null,null,["Последнее обновление: 2025-07-24 UTC."],[[["\u003cp\u003e\u003ccode\u003efilterDate()\u003c/code\u003e allows you to filter a FeatureCollection by a date range based on the \u003ccode\u003esystem:time_start\u003c/code\u003e property.\u003c/p\u003e\n"],["\u003cp\u003eThe start and end dates can be specified as Dates, numbers (milliseconds since epoch), or strings.\u003c/p\u003e\n"],["\u003cp\u003eThe end date is exclusive, and if not specified, a 1-millisecond range starting at the start date is used.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003efilterDate()\u003c/code\u003e is equivalent to using \u003ccode\u003eee.Filter.date()\u003c/code\u003e and is a convenient shortcut for temporal filtering.\u003c/p\u003e\n"]]],[],null,["# ee.FeatureCollection.filterDate\n\n\u003cbr /\u003e\n\nShortcut to filter a collection by a date range. The start and end may be Dates, numbers (interpreted as milliseconds since 1970-01-01T00:00:00Z), or strings (such as '1996-01-01T08:00'). Based on 'system:time_start'.\n\n\u003cbr /\u003e\n\nThis is equivalent to this.filter(ee.Filter.date(...)); see the ee.Filter type for other date filtering options.\n\nReturns the filtered collection.\n\n| Usage | Returns |\n|------------------------------------------------|------------|\n| FeatureCollection.filterDate`(start, `*end*`)` | Collection |\n\n| Argument | Type | Details |\n|--------------------|--------------------------------|-------------------------------------------------------------------------------------------------------------|\n| this: `collection` | Collection | The Collection instance. |\n| `start` | Date\\|Number\\|String | The start date (inclusive). |\n| `end` | Date\\|Number\\|String, optional | The end date (exclusive). Optional. If not specified, a 1-millisecond range starting at 'start' is created. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Constructed FeatureCollection representing a field site sampled at\n// four different dates; date recorded as \"system:time_start\" property in units\n// of milliseconds since Unix epoch.\nvar geom = ee.Geometry.Point([-119.56, 37.67]);\nvar fc = ee.FeatureCollection([\n ee.Feature(geom, {'prop': 10, 'system:time_start': ee.Date('2021-06-10')}),\n ee.Feature(geom, {'prop': 11, 'system:time_start': ee.Date('2021-06-20')}),\n ee.Feature(geom, {'prop': 19, 'system:time_start': ee.Date('2021-07-10')}),\n ee.Feature(geom, {'prop': 10, 'system:time_start': ee.Date('2021-07-20')})\n]);\n\n// Filter the observations in July 2021.\nprint('Field site observations collection in July 2021',\n fc.filterDate('2021-07-01', '2021-08-01'));\n\n// Alternative input formats.\nprint('ee.DateRange as an input',\n fc.filterDate(ee.DateRange('2021-07-01', '2021-08-01')));\n\nprint('Numbers (milliseconds since Unix epoch) as an input',\n fc.filterDate(1625875200000, 1626739200001));\n\nprint('ee.Date objects as an input',\n fc.filterDate(ee.Date('2021-07-01'), ee.Date('2021-08-01')));\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# Constructed FeatureCollection representing a field site sampled at\n# four different dates; date recorded as \"system:time_start\" property in units\n# of milliseconds since Unix epoch.\ngeom = ee.Geometry.Point([-119.56, 37.67])\nfc = ee.FeatureCollection([\n ee.Feature(geom, {'prop': 10, 'system:time_start': ee.Date('2021-06-10')}),\n ee.Feature(geom, {'prop': 11, 'system:time_start': ee.Date('2021-06-20')}),\n ee.Feature(geom, {'prop': 19, 'system:time_start': ee.Date('2021-07-10')}),\n ee.Feature(geom, {'prop': 10, 'system:time_start': ee.Date('2021-07-20')})\n])\n\n# Filter the observations in July 2021.\nprint('Field site observations collection in July 2021:',\n fc.filterDate('2021-07-01', '2021-08-01').getInfo())\n\n# Alternative input formats.\nprint('ee.DateRange as an input:',\n fc.filterDate(ee.DateRange('2021-07-01', '2021-08-01')).getInfo())\n\nprint('Numbers (milliseconds since Unix epoch) as an input:',\n fc.filterDate(1625875200000, 1626739200001).getInfo())\n\nprint('ee.Date objects as an input:',\n fc.filterDate(ee.Date('2021-07-01'), ee.Date('2021-08-01')).getInfo())\n```"]]