公告 :所有在
2025 年 4 月 15 日 之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件 ,才能继续使用 Earth Engine。如果您在 2025 年 9 月 26 日之前未完成验证,您的访问权限可能会被暂停。
发送反馈
ee.ImageCollection.getRegion
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
针对 ImageCollection 中的每个 [像素、波段、影像] 元组,输出一个值数组。输出包含多行数据,每行数据对应于指定区域中与每个像素相交的每个图像的 ID、经度、纬度、时间和所有波段。尝试提取超过 1048576 个值会导致错误。
用法 返回 ImageCollection. getRegion (geometry, scale , crs , crsTransform )
列表
参数 类型 详细信息 此:collection
ImageCollection 要从中提取数据的影像集合。 geometry
几何图形 要提取数据的区域。 scale
浮点数,默认值:null 要使用的投影的标称比例(以米为单位)。 crs
投影,可选 要使用的投影。如果未指定,则默认为 EPSG:4326。如果除了比例之外还指定了其他值,则投影会重新缩放到指定的比例。 crsTransform
列表,默认值:null CRS 转换值数组。这是 3x2 仿射转换的行优先顺序。此选项与缩放选项互斥,并将替换给定投影上已设置的所有转换。
示例
代码编辑器 (JavaScript)
// A Landsat 8 TOA image collection (3 months at a specific point, RGB bands).
var col = ee . ImageCollection ( 'LANDSAT/LC08/C02/T1_TOA' )
. filterBounds ( ee . Geometry . Point ( - 90.70 , 34.71 ))
. filterDate ( '2020-07-01' , '2020-10-01' )
. select ( 'B[2-4]' );
print ( 'Collection' , col );
// Define a region to get pixel values for. This is a small rectangle region
// that intersects 2 image pixels at 30-meter scale.
var roi = ee . Geometry . BBox ( - 90.496353 , 34.851971 , - 90.495749 , 34.852197 );
// Display the region of interest overlaid on an image representative. Note
// the ROI intersection with 2 pixels.
var visParams = {
bands : [ 'B4' , 'B3' , 'B2' ],
min : 0.128 ,
max : 0.163
};
Map . setCenter ( - 90.49605 , 34.85211 , 19 );
Map . addLayer ( col . first (), visParams , 'Image representative' );
Map . addLayer ( roi , { color : 'white' }, 'ROI' );
// Fetch pixel-level information from all images in the collection for the
// pixels intersecting the ROI.
var pixelInfoBbox = col . getRegion ({
geometry : roi ,
scale : 30
});
// The result is a table (a list of lists) where the first row is column
// labels and subsequent rows are image pixels. Columns contain values for
// the image ID ('system:index'), pixel longitude and latitude, image
// observation time ('system:time_start'), and bands. In this example, note
// that there are 5 images and the region intersects 2 pixels, so n rows
// equals 11 (5 * 2 + 1). All collection images must have the same number of
// bands with the same names.
print ( 'Extracted pixel info' , pixelInfoBbox );
// The function accepts all geometry types (e.g., points, lines, polygons).
// Here, a multi-point geometry with two points is used.
var points = ee . Geometry . MultiPoint ([[ - 90.49 , 34.85 ], [ - 90.48 , 34.84 ]]);
var pixelInfoPoints = col . getRegion ({
geometry : points ,
scale : 30
});
print ( 'Point geometry example' , pixelInfoPoints );
Python 设置
如需了解 Python API 和如何使用 geemap
进行交互式开发,请参阅
Python 环境 页面。
import ee
import geemap.core as geemap
Colab (Python)
# A Landsat 8 TOA image collection (3 months at a specific point, RGB bands).
col = (
ee . ImageCollection ( 'LANDSAT/LC08/C02/T1_TOA' )
. filterBounds ( ee . Geometry . Point ( - 90.70 , 34.71 ))
. filterDate ( '2020-07-01' , '2020-10-01' )
. select ( 'B[2-4]' )
)
display ( 'Collection' , col )
# Define a region to get pixel values for. This is a small rectangle region
# that intersects 2 image pixels at 30-meter scale.
roi = ee . Geometry . BBox ( - 90.496353 , 34.851971 , - 90.495749 , 34.852197 )
# Display the region of interest overlaid on an image representative. Note
# the ROI intersection with 2 pixels.
vis_params = { 'bands' : [ 'B4' , 'B3' , 'B2' ], 'min' : 0.128 , 'max' : 0.163 }
m = geemap . Map ()
m . set_center ( - 90.49605 , 34.85211 , 19 )
m . add_layer ( col . first (), vis_params , 'Image representative' )
m . add_layer ( roi , { 'color' : 'white' }, 'ROI' )
display ( m )
# Fetch pixel-level information from all images in the collection for the
# pixels intersecting the ROI.
pixel_info_bbox = col . getRegion ( geometry = roi , scale = 30 )
# The result is a table (a list of lists) where the first row is column
# labels and subsequent rows are image pixels. Columns contain values for
# the image ID ('system:index'), pixel longitude and latitude, image
# observation time ('system:time_start'), and bands. In this example, note
# that there are 5 images and the region intersects 2 pixels, so n rows
# equals 11 (5 * 2 + 1). All collection images must have the same number of
# bands with the same names.
display ( 'Extracted pixel info' , pixel_info_bbox )
# The function accepts all geometry types (e.g., points, lines, polygons).
# Here, a multi-point geometry with two points is used.
points = ee . Geometry . MultiPoint ([[ - 90.49 , 34.85 ], [ - 90.48 , 34.84 ]])
pixel_info_points = col . getRegion ( geometry = points , scale = 30 )
display ( 'Point geometry example' , pixel_info_points )
发送反馈
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可 获得了许可,并且代码示例已根据 Apache 2.0 许可 获得了许可。有关详情,请参阅 Google 开发者网站政策 。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
需要向我们提供更多信息?
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-26。"],[],["The `ImageCollection.getRegion` method extracts pixel values from an ImageCollection within a specified geometry. It returns a list containing rows of data for each \\[pixel, band, image\\] tuple, including id, longitude, latitude, time, and band values. Users define the extraction region, scale, and optionally the projection. The output format is a table where rows represent pixels and columns detail each image's data. The method accepts various geometry types but is limited to extracting 1,048,576 values per request.\n"]]