公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
图片概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如开始使用文档中所述,在 Earth Engine 中,栅格数据表示为 Image
对象。图像由一个或多个波段组成,每个波段都有自己的名称、数据类型、比例、掩码和投影。每个图片的元数据都存储为一组属性。
ee.Image
构造函数
您可以通过将 Earth Engine 资产 ID 粘贴到 ee.Image
构造函数中来加载图片。您可以在数据目录中找到图片 ID。
例如,对数字海拔模型 (NASADEM) 进行投影:
Code Editor (JavaScript)
var loadedImage = ee.Image('NASA/NASADEM_HGT/001');
Python 设置
如需了解 Python API 以及如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
loaded_image = ee.Image('NASA/NASADEM_HGT/001')
请注意,通过代码编辑器搜索工具查找图片也是可行的。导入资源后,系统会在代码编辑器的“导入”部分为您编写图片构建代码。您还可以将个人素材资源 ID 用作 ee.Image
构造函数的参数。
从 ee.ImageCollection
获取 ee.Image
从合集中获取图片的标准方法是过滤合集,过滤条件的具体性依次递减。例如,如需从 Sentinel-2 地表反射率集合中获取图片,请执行以下操作:
Code Editor (JavaScript)
var first = ee.ImageCollection('COPERNICUS/S2_SR')
.filterBounds(ee.Geometry.Point(-70.48, 43.3631))
.filterDate('2019-01-01', '2019-12-31')
.sort('CLOUDY_PIXEL_PERCENTAGE')
.first();
Map.centerObject(first, 11);
Map.addLayer(first, {bands: ['B4', 'B3', 'B2'], min: 0, max: 2000}, 'first');
Python 设置
如需了解 Python API 以及如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
first = (
ee.ImageCollection('COPERNICUS/S2_SR')
.filterBounds(ee.Geometry.Point(-70.48, 43.3631))
.filterDate('2019-01-01', '2019-12-31')
.sort('CLOUDY_PIXEL_PERCENTAGE')
.first()
)
# Define a map centered on southern Maine.
m = geemap.Map(center=[43.7516, -70.8155], zoom=11)
# Add the image layer to the map and display it.
m.add_layer(
first, {'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 2000}, 'first'
)
display(m)
请注意,排序是在过滤条件之后进行的。避免对整个集合进行排序。
来自 Cloud GeoTIFF 的图片
您可以使用 ee.Image.loadGeoTIFF()
从 Google Cloud Storage 中的经过 Cloud 优化的 GeoTIFF 加载图片。
例如,托管在 Google Cloud 中的公开 Landsat 数据集包含此 GeoTIFF,对应于 Landsat 8 场景中的第 5 个波段。您可以使用 ee.Image.loadGeoTIFF()
从 Cloud Storage 加载此图片:
Code Editor (JavaScript)
var uri = 'gs://gcp-public-data-landsat/LC08/01/001/002/' +
'LC08_L1GT_001002_20160817_20170322_01_T2/' +
'LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF';
var cloudImage = ee.Image.loadGeoTIFF(uri);
print(cloudImage);
Python 设置
如需了解 Python API 以及如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
uri = (
'gs://gcp-public-data-landsat/LC08/01/001/002/'
+ 'LC08_L1GT_001002_20160817_20170322_01_T2/'
+ 'LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF'
)
cloud_image = ee.Image.loadGeoTIFF(uri)
display(cloud_image)
请注意,如果您想重新加载从 Earth Engine 导出到 Cloud Storage 的 Cloud 优化型 GeoTIFF,请在导出时将 cloudOptimized
设置为 true,如此处所述。
来自 Zarr v2 数组的图片
您可以使用 ee.Image.loadZarrV2Array()
从 Google Cloud Storage 中的 Zarr v2 数组加载图片。例如,托管在 Google Cloud 中的公共 ERA5 数据集包含此 Zarr v2 数组,对应于从地球表面蒸发的水量(以米为单位)。您可以使用 ee.Image.loadZarrV2Array()
从 Cloud Storage 加载此数组:
Code Editor (JavaScript)
var timeStart = 1000000;
var timeEnd = 1000010;
var zarrV2ArrayImage = ee.Image.loadZarrV2Array({
uri:
'gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3/evaporation/.zarray',
proj: 'EPSG:4326',
starts: [timeStart],
ends: [timeEnd]
});
print(zarrV2ArrayImage);
Map.addLayer(zarrV2ArrayImage, {min: -0.0001, max: 0.00005}, 'Evaporation');
Python 设置
如需了解 Python API 以及如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
time_start = 1000000
time_end = 1000010
zarr_v2_array_image = ee.Image.loadZarrV2Array(
uri='gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3/evaporation/.zarray',
proj='EPSG:4326',
starts=[time_start],
ends=[time_end],
)
display(zarr_v2_array_image)
m.add_layer(
zarr_v2_array_image, {'min': -0.0001, 'max': 0.00005}, 'Evaporation'
)
m
常量图片
除了按 ID 加载图片外,您还可以使用常量、列表或其他合适的 Earth Engine 对象创建图片。以下示例展示了创建图片、获取波段子集和操作波段的方法:
Code Editor (JavaScript)
// Create a constant image.
var image1 = ee.Image(1);
print(image1);
// Concatenate two images into one multi-band image.
var image2 = ee.Image(2);
var image3 = ee.Image.cat([image1, image2]);
print(image3);
// Create a multi-band image from a list of constants.
var multiband = ee.Image([1, 2, 3]);
print(multiband);
// Select and (optionally) rename bands.
var renamed = multiband.select(
['constant', 'constant_1', 'constant_2'], // old names
['band1', 'band2', 'band3'] // new names
);
print(renamed);
// Add bands to an image.
var image4 = image3.addBands(ee.Image(42));
print(image4);
Python 设置
如需了解 Python API 以及如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
# Create a constant image.
image_1 = ee.Image(1)
display(image_1)
# Concatenate two images into one multi-band image.
image_2 = ee.Image(2)
image_3 = ee.Image.cat([image_1, image_2])
display(image_3)
# Create a multi-band image from a list of constants.
multiband = ee.Image([1, 2, 3])
display(multiband)
# Select and (optionally) rename bands.
renamed = multiband.select(
['constant', 'constant_1', 'constant_2'], # old names
['band1', 'band2', 'band3'], # new names
)
display(renamed)
# Add bands to an image.
image_4 = image_3.addBands(ee.Image(42))
display(image_4)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eIn Earth Engine, raster data is represented as \u003ccode\u003eImage\u003c/code\u003e objects, which can be created by loading existing assets or by defining them with constant values.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eImage\u003c/code\u003e objects can be created from Earth Engine assets, \u003ccode\u003eImageCollection\u003c/code\u003e objects, and Cloud Optimized GeoTIFFs (COG) stored in Google Cloud Storage.\u003c/p\u003e\n"],["\u003cp\u003eImages in Earth Engine are composed of bands, each with its own data type, scale, mask, and projection, and images can be manipulated using methods such as \u003ccode\u003eselect\u003c/code\u003e, \u003ccode\u003eaddBands\u003c/code\u003e, and \u003ccode\u003ecat\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eImageCollection\u003c/code\u003e objects can be filtered and sorted to retrieve specific images, and \u003ccode\u003eee.Image.loadGeoTIFF()\u003c/code\u003e is used to load images from Cloud Optimized GeoTIFFs in Cloud Storage.\u003c/p\u003e\n"],["\u003cp\u003eConstant images can be created from numerical values, lists of values, and other suitable Earth Engine objects, allowing for flexible image manipulation and analysis.\u003c/p\u003e\n"]]],[],null,["# Image Overview\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|\n| [Run in Google Colab](https://colab.research.google.com/github/google/earthengine-community/blob/master/guides/linked/generated/image_overview.ipynb) | [View source on GitHub](https://github.com/google/earthengine-community/blob/master/guides/linked/generated/image_overview.ipynb) |\n\nAs mentioned in the [Get Started](/earth-engine/guides/getstarted#earth-engine-data-structures)\ndoc, raster data are represented as `Image` objects in Earth Engine. Images are\ncomposed of one or more bands and each band has its own name, data type, scale, mask\nand projection. Each image has metadata stored as a set of properties.\n\n`ee.Image` constructor\n----------------------\n\nImages can be loaded by pasting an Earth Engine asset ID into the `ee.Image`\nconstructor. You can find image IDs in the [data catalog](/earth-engine/datasets).\nFor example, to a digial elevation model ([NASADEM](/earth-engine/datasets/catalog/NASA_NASADEM_HGT_001)):\n\n### Code Editor (JavaScript)\n\n```javascript\nvar loadedImage = ee.Image('NASA/NASADEM_HGT/001');\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\nloaded_image = ee.Image('NASA/NASADEM_HGT/001')\n```\n\n\nNote that finding an image through\n[the Code Editor search tool](/earth-engine/guides/playground#search-tool)\nis equivalent. When you import the asset, the image construction code is written\nfor you in the [imports section of the\nCode Editor](/earth-engine/guides/playground#imports). You can also use a personal\n[asset ID](/earth-engine/guides/manage_assets#asset_id) as the argument to the\n`ee.Image` constructor.\n\nGet an `ee.Image` from an `ee.ImageCollection`\n----------------------------------------------\n\n\nThe standard way to get an image out of a collection is to filter the collection, with\nfilters in order of decreasing specificity. For example, to get an image out of the\n[Sentinel-2 surface reflectance collection](/earth-engine/datasets/catalog/COPERNICUS_S2_SR):\n\n### Code Editor (JavaScript)\n\n```javascript\nvar first = ee.ImageCollection('COPERNICUS/S2_SR')\n .filterBounds(ee.Geometry.Point(-70.48, 43.3631))\n .filterDate('2019-01-01', '2019-12-31')\n .sort('CLOUDY_PIXEL_PERCENTAGE')\n .first();\nMap.centerObject(first, 11);\nMap.addLayer(first, {bands: ['B4', 'B3', 'B2'], min: 0, max: 2000}, 'first');\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\nfirst = (\n ee.ImageCollection('COPERNICUS/S2_SR')\n .filterBounds(ee.Geometry.Point(-70.48, 43.3631))\n .filterDate('2019-01-01', '2019-12-31')\n .sort('CLOUDY_PIXEL_PERCENTAGE')\n .first()\n)\n\n# Define a map centered on southern Maine.\nm = geemap.Map(center=[43.7516, -70.8155], zoom=11)\n\n# Add the image layer to the map and display it.\nm.add_layer(\n first, {'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 2000}, 'first'\n)\ndisplay(m)\n```\n\n\nNote that the sort is *after* the filters. Avoid sorting the entire collection.\n\nImages from Cloud GeoTIFFs\n--------------------------\n\n\nYou can use `ee.Image.loadGeoTIFF()` to load images from\n[Cloud Optimized\nGeoTIFFs](https://github.com/cogeotiff/cog-spec/blob/master/spec.md) in [Google Cloud Storage](https://cloud.google.com/storage).\nFor example, the\n[public\nLandsat dataset](https://console.cloud.google.com/marketplace/details/usgs-public-data/landast) hosted in Google Cloud contains\n[this\nGeoTIFF](https://console.cloud.google.com/storage/browser/_details/gcp-public-data-landsat/LC08/01/001/002/LC08_L1GT_001002_20160817_20170322_01_T2/LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF), corresponding to band 5 from a Landsat 8 scene. You can load this image from\nCloud Storage using `ee.Image.loadGeoTIFF()`:\n\n### Code Editor (JavaScript)\n\n```javascript\nvar uri = 'gs://gcp-public-data-landsat/LC08/01/001/002/' +\n 'LC08_L1GT_001002_20160817_20170322_01_T2/' +\n 'LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF';\nvar cloudImage = ee.Image.loadGeoTIFF(uri);\nprint(cloudImage);\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\nuri = (\n 'gs://gcp-public-data-landsat/LC08/01/001/002/'\n + 'LC08_L1GT_001002_20160817_20170322_01_T2/'\n + 'LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF'\n)\ncloud_image = ee.Image.loadGeoTIFF(uri)\ndisplay(cloud_image)\n```\n\n\nNote that if you want to reload a Cloud Optimized GeoTIFF that you\n[export from Earth Engine to\nCloud Storage](/earth-engine/guides/exporting#to-cloud-storage), when you do the export, set\n`cloudOptimized` to **true** as\ndescribed [here](/earth-engine/guides/exporting#configuration-parameters).\n\nImages from Zarr v2 arrays\n--------------------------\n\n\nYou can use `ee.Image.loadZarrV2Array()` to load an image from a\n[Zarr v2 array](https://zarr-specs.readthedocs.io/en/latest/v2/v2.0.html) in\n[Google Cloud Storage](https://cloud.google.com/storage). For example, the public\nERA5 dataset hosted in Google Cloud contains\n[this Zarr v2 array](https://console.cloud.google.com/storage/browser/_details/gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3/evaporation/.zarray),\ncorresponding to meters of water that has evaporated from the Earth's surface. You can load\nthis array from Cloud Storage using `ee.Image.loadZarrV2Array()`:\n\n### Code Editor (JavaScript)\n\n```javascript\nvar timeStart = 1000000;\nvar timeEnd = 1000010;\nvar zarrV2ArrayImage = ee.Image.loadZarrV2Array({\n uri:\n 'gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3/evaporation/.zarray',\n proj: 'EPSG:4326',\n starts: [timeStart],\n ends: [timeEnd]\n});\nprint(zarrV2ArrayImage);\nMap.addLayer(zarrV2ArrayImage, {min: -0.0001, max: 0.00005}, 'Evaporation');\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\ntime_start = 1000000\ntime_end = 1000010\nzarr_v2_array_image = ee.Image.loadZarrV2Array(\n uri='gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3/evaporation/.zarray',\n proj='EPSG:4326',\n starts=[time_start],\n ends=[time_end],\n)\n\ndisplay(zarr_v2_array_image)\n\nm.add_layer(\n zarr_v2_array_image, {'min': -0.0001, 'max': 0.00005}, 'Evaporation'\n)\nm\n```\n\nConstant images\n---------------\n\nIn addition to loading images by ID, you can also create images\nfrom constants, lists or other suitable Earth Engine objects. The following illustrates\nmethods for creating images, getting band subsets, and manipulating bands:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Create a constant image.\nvar image1 = ee.Image(1);\nprint(image1);\n\n// Concatenate two images into one multi-band image.\nvar image2 = ee.Image(2);\nvar image3 = ee.Image.cat([image1, image2]);\nprint(image3);\n\n// Create a multi-band image from a list of constants.\nvar multiband = ee.Image([1, 2, 3]);\nprint(multiband);\n\n// Select and (optionally) rename bands.\nvar renamed = multiband.select(\n ['constant', 'constant_1', 'constant_2'], // old names\n ['band1', 'band2', 'band3'] // new names\n);\nprint(renamed);\n\n// Add bands to an image.\nvar image4 = image3.addBands(ee.Image(42));\nprint(image4);\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# Create a constant image.\nimage_1 = ee.Image(1)\ndisplay(image_1)\n\n# Concatenate two images into one multi-band image.\nimage_2 = ee.Image(2)\nimage_3 = ee.Image.cat([image_1, image_2])\ndisplay(image_3)\n\n# Create a multi-band image from a list of constants.\nmultiband = ee.Image([1, 2, 3])\ndisplay(multiband)\n\n# Select and (optionally) rename bands.\nrenamed = multiband.select(\n ['constant', 'constant_1', 'constant_2'], # old names\n ['band1', 'band2', 'band3'], # new names\n)\ndisplay(renamed)\n\n# Add bands to an image.\nimage_4 = image_3.addBands(ee.Image(42))\ndisplay(image_4)\n```"]]