Объявление : Все некоммерческие проекты, зарегистрированные для использования Earth Engine до
15 апреля 2025 года, должны
подтвердить некоммерческое право на сохранение доступа к Earth Engine.
ee.ImageCollection.fromImages
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Возвращает коллекцию изображений, содержащую заданные изображения.
Использование | Возврат | ee.ImageCollection.fromImages(images) | Коллекция изображений |
Аргумент | Тип | Подробности | images | Список | Изображения для включения в коллекцию. |
Примеры
Редактор кода (JavaScript)
// A series of images.
var img1 = ee.Image(0);
var img2 = ee.Image(1);
var img3 = ee.Image(2);
// Convert the list of images into an image collection.
var col = ee.ImageCollection.fromImages([img1, img2, img3]);
print('Collection from list of images', col);
// The ee.ImageCollection.fromImages function is intended to coerce the image
// list to a collection when the list is an ambiguous, computed object fetched
// from the properties of a server-side object. For instance, a list
// of images retrieved from a ee.Feature property. Here, we set an image
// list as a property of a feature, retrieve it, and convert it to
// a collection. Notice that the ee.ImageCollection constructor fails to coerce
// the image list to a collection, but ee.ImageCollection.fromImages does.
var feature = ee.Feature(null).set('img_list', [img1, img2, img3]);
var ambiguousImgList = feature.get('img_list');
print('Coerced to collection', ee.ImageCollection.fromImages(ambiguousImgList));
print('NOT coerced to collection', ee.ImageCollection(ambiguousImgList));
// A common use case is coercing an image list from a saveAll join to a
// image collection, like in this example of building a collection of mean
// annual NDVI images from a MODIS collection.
var modisCol = ee.ImageCollection('MODIS/006/MOD13A2')
.filterDate('2017', '2021')
.select('NDVI')
.map(function(img) {return img.set('year', img.date().get('year'))});
var distinctYearCol = modisCol.distinct('year');
var joinedCol = ee.Join.saveAll('img_list').apply({
primary: distinctYearCol,
secondary: modisCol,
condition: ee.Filter.equals({'leftField': 'year', 'rightField': 'year'})
});
var annualNdviMean = joinedCol.map(function(img) {
return ee.ImageCollection.fromImages(img.get('img_list')).mean()
.copyProperties(img, ['year']);
});
print('Mean annual NDVI collection', annualNdviMean);
Настройка Python
Информацию об API Python и использовании geemap
для интерактивной разработки см. на странице «Среда Python» .
import ee
import geemap.core as geemap
Colab (Python)
# A series of images.
img1 = ee.Image(0)
img2 = ee.Image(1)
img3 = ee.Image(2)
# Convert the list of images into an image collection.
col = ee.ImageCollection.fromImages([img1, img2, img3])
print('Collection from list of images:', col.getInfo())
# The ee.ImageCollection.fromImages function is intended to coerce the image
# list to a collection when the list is an ambiguous, computed object fetched
# from the properties of a server-side object. For instance, a list
# of images retrieved from a ee.Feature property. Here, we set an image
# list as a property of a feature, retrieve it, and convert it to
# a collection. Notice that the ee.ImageCollection constructor fails to coerce
# the image list to a collection, but ee.ImageCollection.fromImages does.
feature = ee.Feature(None).set('img_list', [img1, img2, img3])
ambiguous_img_list = feature.get('img_list')
print(
'Coerced to collection:',
ee.ImageCollection.fromImages(ambiguous_img_list).getInfo(),
)
print(
'NOT coerced to collection:',
ee.ImageCollection(ambiguous_img_list).getInfo(),
)
# A common use case is coercing an image list from a saveAll join to a
# image collection, like in this example of building a collection of mean
# annual NDVI images from a MODIS collection.
modis_col = (
ee.ImageCollection('MODIS/006/MOD13A2')
.filterDate('2017', '2021')
.select('NDVI')
.map(lambda img: img.set('year', img.date().get('year')))
)
distinct_year_col = modis_col.distinct('year')
joined_col = ee.Join.saveAll('img_list').apply(
primary=distinct_year_col,
secondary=modis_col,
condition=ee.Filter.equals(leftField='year', rightField='year'),
)
annual_ndvi_mean = joined_col.map(
lambda img: ee.ImageCollection.fromImages(img.get('img_list'))
.mean()
.copyProperties(img, ['year'])
)
print('Mean annual NDVI collection:', annual_ndvi_mean.getInfo())
,Возвращает коллекцию изображений, содержащую заданные изображения.
Использование | Возврат | ee.ImageCollection.fromImages(images) | Коллекция изображений |
Аргумент | Тип | Подробности | images | Список | Изображения для включения в коллекцию. |
Примеры
Редактор кода (JavaScript)
// A series of images.
var img1 = ee.Image(0);
var img2 = ee.Image(1);
var img3 = ee.Image(2);
// Convert the list of images into an image collection.
var col = ee.ImageCollection.fromImages([img1, img2, img3]);
print('Collection from list of images', col);
// The ee.ImageCollection.fromImages function is intended to coerce the image
// list to a collection when the list is an ambiguous, computed object fetched
// from the properties of a server-side object. For instance, a list
// of images retrieved from a ee.Feature property. Here, we set an image
// list as a property of a feature, retrieve it, and convert it to
// a collection. Notice that the ee.ImageCollection constructor fails to coerce
// the image list to a collection, but ee.ImageCollection.fromImages does.
var feature = ee.Feature(null).set('img_list', [img1, img2, img3]);
var ambiguousImgList = feature.get('img_list');
print('Coerced to collection', ee.ImageCollection.fromImages(ambiguousImgList));
print('NOT coerced to collection', ee.ImageCollection(ambiguousImgList));
// A common use case is coercing an image list from a saveAll join to a
// image collection, like in this example of building a collection of mean
// annual NDVI images from a MODIS collection.
var modisCol = ee.ImageCollection('MODIS/006/MOD13A2')
.filterDate('2017', '2021')
.select('NDVI')
.map(function(img) {return img.set('year', img.date().get('year'))});
var distinctYearCol = modisCol.distinct('year');
var joinedCol = ee.Join.saveAll('img_list').apply({
primary: distinctYearCol,
secondary: modisCol,
condition: ee.Filter.equals({'leftField': 'year', 'rightField': 'year'})
});
var annualNdviMean = joinedCol.map(function(img) {
return ee.ImageCollection.fromImages(img.get('img_list')).mean()
.copyProperties(img, ['year']);
});
print('Mean annual NDVI collection', annualNdviMean);
Настройка Python
Информацию об API Python и использовании geemap
для интерактивной разработки см. на странице «Среда Python» .
import ee
import geemap.core as geemap
Colab (Python)
# A series of images.
img1 = ee.Image(0)
img2 = ee.Image(1)
img3 = ee.Image(2)
# Convert the list of images into an image collection.
col = ee.ImageCollection.fromImages([img1, img2, img3])
print('Collection from list of images:', col.getInfo())
# The ee.ImageCollection.fromImages function is intended to coerce the image
# list to a collection when the list is an ambiguous, computed object fetched
# from the properties of a server-side object. For instance, a list
# of images retrieved from a ee.Feature property. Here, we set an image
# list as a property of a feature, retrieve it, and convert it to
# a collection. Notice that the ee.ImageCollection constructor fails to coerce
# the image list to a collection, but ee.ImageCollection.fromImages does.
feature = ee.Feature(None).set('img_list', [img1, img2, img3])
ambiguous_img_list = feature.get('img_list')
print(
'Coerced to collection:',
ee.ImageCollection.fromImages(ambiguous_img_list).getInfo(),
)
print(
'NOT coerced to collection:',
ee.ImageCollection(ambiguous_img_list).getInfo(),
)
# A common use case is coercing an image list from a saveAll join to a
# image collection, like in this example of building a collection of mean
# annual NDVI images from a MODIS collection.
modis_col = (
ee.ImageCollection('MODIS/006/MOD13A2')
.filterDate('2017', '2021')
.select('NDVI')
.map(lambda img: img.set('year', img.date().get('year')))
)
distinct_year_col = modis_col.distinct('year')
joined_col = ee.Join.saveAll('img_list').apply(
primary=distinct_year_col,
secondary=modis_col,
condition=ee.Filter.equals(leftField='year', rightField='year'),
)
annual_ndvi_mean = joined_col.map(
lambda img: ee.ImageCollection.fromImages(img.get('img_list'))
.mean()
.copyProperties(img, ['year'])
)
print('Mean annual NDVI collection:', annual_ndvi_mean.getInfo())
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-07-24 UTC.
[null,null,["Последнее обновление: 2025-07-24 UTC."],[[["\u003cp\u003e\u003ccode\u003eee.ImageCollection.fromImages()\u003c/code\u003e creates an \u003ccode\u003eImageCollection\u003c/code\u003e from a list of \u003ccode\u003eee.Image\u003c/code\u003e objects.\u003c/p\u003e\n"],["\u003cp\u003eThis function is particularly useful for converting ambiguous, server-side image lists into \u003ccode\u003eImageCollection\u003c/code\u003e objects.\u003c/p\u003e\n"],["\u003cp\u003eA common use case is processing image lists obtained from \u003ccode\u003eee.Join.saveAll()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eee.ImageCollection.fromImages()\u003c/code\u003e enables efficient manipulation and analysis of image data within Earth Engine.\u003c/p\u003e\n"]]],["`ee.ImageCollection.fromImages(images)` converts a list of images into an ImageCollection. This function is crucial for handling ambiguous, computed image lists, like those retrieved from server-side object properties. It successfully coerces image lists into collections, unlike the standard `ee.ImageCollection` constructor. A common use case is processing lists generated by `ee.Join.saveAll`, demonstrated by building a collection of mean annual NDVI images from MODIS data, efficiently grouping images and calculating yearly averages.\n"],null,["# ee.ImageCollection.fromImages\n\nReturns the image collection containing the given images.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------|-----------------|\n| `ee.ImageCollection.fromImages(images)` | ImageCollection |\n\n| Argument | Type | Details |\n|----------|------|------------------------------------------|\n| `images` | List | The images to include in the collection. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A series of images.\nvar img1 = ee.Image(0);\nvar img2 = ee.Image(1);\nvar img3 = ee.Image(2);\n\n// Convert the list of images into an image collection.\nvar col = ee.ImageCollection.fromImages([img1, img2, img3]);\nprint('Collection from list of images', col);\n\n// The ee.ImageCollection.fromImages function is intended to coerce the image\n// list to a collection when the list is an ambiguous, computed object fetched\n// from the properties of a server-side object. For instance, a list\n// of images retrieved from a ee.Feature property. Here, we set an image\n// list as a property of a feature, retrieve it, and convert it to\n// a collection. Notice that the ee.ImageCollection constructor fails to coerce\n// the image list to a collection, but ee.ImageCollection.fromImages does.\nvar feature = ee.Feature(null).set('img_list', [img1, img2, img3]);\nvar ambiguousImgList = feature.get('img_list');\nprint('Coerced to collection', ee.ImageCollection.fromImages(ambiguousImgList));\nprint('NOT coerced to collection', ee.ImageCollection(ambiguousImgList));\n\n// A common use case is coercing an image list from a saveAll join to a\n// image collection, like in this example of building a collection of mean\n// annual NDVI images from a MODIS collection.\nvar modisCol = ee.ImageCollection('MODIS/006/MOD13A2')\n .filterDate('2017', '2021')\n .select('NDVI')\n .map(function(img) {return img.set('year', img.date().get('year'))});\n\nvar distinctYearCol = modisCol.distinct('year');\n\nvar joinedCol = ee.Join.saveAll('img_list').apply({\n primary: distinctYearCol,\n secondary: modisCol,\n condition: ee.Filter.equals({'leftField': 'year', 'rightField': 'year'})\n});\n\nvar annualNdviMean = joinedCol.map(function(img) {\n return ee.ImageCollection.fromImages(img.get('img_list')).mean()\n .copyProperties(img, ['year']);\n});\nprint('Mean annual NDVI collection', annualNdviMean);\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 images.\nimg1 = ee.Image(0)\nimg2 = ee.Image(1)\nimg3 = ee.Image(2)\n\n# Convert the list of images into an image collection.\ncol = ee.ImageCollection.fromImages([img1, img2, img3])\nprint('Collection from list of images:', col.getInfo())\n\n# The ee.ImageCollection.fromImages function is intended to coerce the image\n# list to a collection when the list is an ambiguous, computed object fetched\n# from the properties of a server-side object. For instance, a list\n# of images retrieved from a ee.Feature property. Here, we set an image\n# list as a property of a feature, retrieve it, and convert it to\n# a collection. Notice that the ee.ImageCollection constructor fails to coerce\n# the image list to a collection, but ee.ImageCollection.fromImages does.\nfeature = ee.Feature(None).set('img_list', [img1, img2, img3])\nambiguous_img_list = feature.get('img_list')\nprint(\n 'Coerced to collection:',\n ee.ImageCollection.fromImages(ambiguous_img_list).getInfo(),\n)\nprint(\n 'NOT coerced to collection:',\n ee.ImageCollection(ambiguous_img_list).getInfo(),\n)\n\n# A common use case is coercing an image list from a saveAll join to a\n# image collection, like in this example of building a collection of mean\n# annual NDVI images from a MODIS collection.\nmodis_col = (\n ee.ImageCollection('MODIS/006/MOD13A2')\n .filterDate('2017', '2021')\n .select('NDVI')\n .map(lambda img: img.set('year', img.date().get('year')))\n)\n\ndistinct_year_col = modis_col.distinct('year')\n\njoined_col = ee.Join.saveAll('img_list').apply(\n primary=distinct_year_col,\n secondary=modis_col,\n condition=ee.Filter.equals(leftField='year', rightField='year'),\n)\n\nannual_ndvi_mean = joined_col.map(\n lambda img: ee.ImageCollection.fromImages(img.get('img_list'))\n .mean()\n .copyProperties(img, ['year'])\n)\nprint('Mean annual NDVI collection:', annual_ndvi_mean.getInfo())\n```"]]