公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ui.Chart.image.seriesByRegion
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
根据图片集合生成图表。提取并绘制集合中每张图片在每个区域中指定波段的值。通常是时间序列。
- X 轴 = 由 xProperty 标记的图片(默认值:'system:time_start')。
- Y 轴 = Reducer 输出。
- 序列 = 由 seriesProperty 标记的区域(默认值:'system:index')。
返回图表。
用法 | 返回 |
---|
ui.Chart.image.seriesByRegion(imageCollection, regions, reducer, band, scale, xProperty, seriesProperty) | ui.Chart |
参数 | 类型 | 详细信息 |
---|
imageCollection | ImageCollection | 包含要纳入图表中的数据的 ImageCollection。 |
regions | Feature|FeatureCollection|Geometry|List<Feature>|List<Geometry> | 要缩减的区域。 |
reducer | 缩减器 | 用于生成 y 轴值的精简器。必须返回单个值。 |
band | Number|String,可选 | 要使用精简器减少的频段名称。默认为第一个频段。 |
scale | 数字,可选 | 用于与缩减器搭配使用的缩放比例(以米为单位)。 |
xProperty | 字符串,可选 | 用作 x 轴上每张图片的标签的属性。默认值为“system:time_start”。 |
seriesProperty | 字符串,可选 | opt_regions 中用于序列标签的功能的属性。默认为“system:index”。 |
示例
代码编辑器 (JavaScript)
// Define regions of pixels to reduce and chart a time series for.
var regions = ee.FeatureCollection([
ee.Feature(
ee.Geometry.BBox(-121.916, 37.130, -121.844, 37.076), {label: 'Forest'}),
ee.Feature(
ee.Geometry.BBox(-122.438, 37.765, -122.396, 37.800), {label: 'Urban'})
]);
// Define an image collection time series to chart, MODIS vegetation indices
// in this case.
var imgCol = ee.ImageCollection('MODIS/006/MOD13A1')
.filter(ee.Filter.date('2015-01-01', '2020-01-01'))
.select(['NDVI', 'EVI']);
// Define the chart and print it to the console.
var chart = ui.Chart.image.seriesByRegion({
imageCollection: imgCol,
band: 'NDVI',
regions: regions,
reducer: ee.Reducer.mean(),
scale: 500,
seriesProperty: 'label',
xProperty: 'system:time_start'
})
.setOptions({
title: 'Average NDVI Value by Date',
hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},
vAxis: {
title: 'NDVI (x1e4)',
titleTextStyle: {italic: false, bold: true}
},
lineWidth: 5,
colors: ['0f8755', '808080'],
});
print(chart);
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eGenerates a chart that visualizes the change in a specific band's value over time within defined regions of an image collection.\u003c/p\u003e\n"],["\u003cp\u003eCharts the reducer output on the y-axis, time (or a specified property) on the x-axis, and uses regions as separate series.\u003c/p\u003e\n"],["\u003cp\u003eOffers customization options for the chart's appearance, such as titles, axes labels, line properties, and series colors, enabling detailed visual representation of the data.\u003c/p\u003e\n"],["\u003cp\u003eUses a reducer to summarize pixel values within each region for every image in the collection, allowing for analysis of trends and patterns.\u003c/p\u003e\n"],["\u003cp\u003eAccepts an image collection, regions of interest, a reducer, and optional parameters for band selection, scale, and property labeling for flexible data analysis and visualization.\u003c/p\u003e\n"]]],["This code generates a chart from an image collection, extracting and plotting band values per region. It uses `ui.Chart.image.seriesByRegion` with parameters: `imageCollection`, `regions`, `reducer`, `band`, `scale`, `xProperty`, and `seriesProperty`. The x-axis represents images labeled by `xProperty`, the y-axis shows the reducer's output, and series are labeled by `seriesProperty`. It takes data from an `imageCollection`, reduces it based on regions, and displays the results in a chart, frequently displaying a time series. An example provided uses MODIS vegetation indices.\n"],null,["# ui.Chart.image.seriesByRegion\n\n\u003cbr /\u003e\n\nGenerates a Chart from an image collection. Extracts and plots the value of the specified band in each region for each image in the collection. Usually a time series.\n\n\u003cbr /\u003e\n\n- X-axis = Image labeled by xProperty (default: 'system:time_start').\n\n- Y-axis = Reducer output.\n\n- Series = Region labeled by seriesProperty (default: 'system:index').\n\nReturns a chart.\n\n| Usage | Returns |\n|-------------------------------------------------------------------------------------------------------------------------------|----------|\n| `ui.Chart.image.seriesByRegion(imageCollection, regions, reducer, `*band* `, `*scale* `, `*xProperty* `, `*seriesProperty*`)` | ui.Chart |\n\n| Argument | Type | Details |\n|-------------------|-------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|\n| `imageCollection` | ImageCollection | An ImageCollection with data to be included in the chart. |\n| `regions` | Feature\\|FeatureCollection\\|Geometry\\|List\\\u003cFeature\\\u003e\\|List\\\u003cGeometry\\\u003e | The regions to reduce. |\n| `reducer` | Reducer | Reducer that generates the value for the y-axis. Must return a single value. |\n| `band` | Number\\|String, optional | The band name to reduce using the reducer. Defaults to the first band. |\n| `scale` | Number, optional | Scale to use with the reducer in meters. |\n| `xProperty` | String, optional | Property to be used as the label for each image on the x-axis. Defaults to 'system:time_start'. |\n| `seriesProperty` | String, optional | Property of features in opt_regions to be used for series labels. Defaults to 'system:index'. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Define regions of pixels to reduce and chart a time series for.\nvar regions = ee.FeatureCollection([\n ee.Feature(\n ee.Geometry.BBox(-121.916, 37.130, -121.844, 37.076), {label: 'Forest'}),\n ee.Feature(\n ee.Geometry.BBox(-122.438, 37.765, -122.396, 37.800), {label: 'Urban'})\n]);\n\n// Define an image collection time series to chart, MODIS vegetation indices\n// in this case.\nvar imgCol = ee.ImageCollection('MODIS/006/MOD13A1')\n .filter(ee.Filter.date('2015-01-01', '2020-01-01'))\n .select(['NDVI', 'EVI']);\n\n// Define the chart and print it to the console.\nvar chart = ui.Chart.image.seriesByRegion({\n imageCollection: imgCol,\n band: 'NDVI',\n regions: regions,\n reducer: ee.Reducer.mean(),\n scale: 500,\n seriesProperty: 'label',\n xProperty: 'system:time_start'\n})\n.setOptions({\n title: 'Average NDVI Value by Date',\n hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},\n vAxis: {\n title: 'NDVI (x1e4)',\n titleTextStyle: {italic: false, bold: true}\n },\n lineWidth: 5,\n colors: ['0f8755', '808080'],\n});\nprint(chart);\n```"]]