公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.Image.reduceToVectors
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
通过减少同质区域将图片转换为要素集合。给定一张包含一个带标签的细分受众群带和零个或多个额外带的图片,对每个细分受众群中的像素运行化简函数,从而为每个细分受众群生成一个特征。
reducer 的输入数量必须比影像的波段数量少一个,或者必须只有一个输入,并且会针对每个波段重复使用。
用法 | 返回 |
---|
Image.reduceToVectors(reducer, geometry, scale, geometryType, eightConnected, labelProperty, crs, crsTransform, bestEffort, maxPixels, tileScale, geometryInNativeProjection) | FeatureCollection |
参数 | 类型 | 详细信息 |
---|
此:image | 图片 | 输入图片。第一个波段应为整数类型;如果相邻像素在此波段中具有相同的值,则它们将位于同一细分中。 |
reducer | 缩减器,默认值:null | 要应用的缩减器。其输入将来自舍弃第一个波段后的图像波段。默认值为 Reducer.countEvery()。 |
geometry | 几何图形,默认值:null | 要减少数据的区域。默认为影像第一个波段的覆盖区。 |
scale | 浮点数,默认值:null | 要使用的投影的标称比例(以米为单位)。 |
geometryType | 字符串,默认值:“polygon” | 如何选择每个生成地图项的几何图形;可以是以下值之一:“polygon”(包含细分中像素的多边形)、“bb”(包含像素的矩形)或“centroid”(像素的质心)。 |
eightConnected | 布尔值,默认值:true | 如果为 true,则对角线连接的像素被视为相邻像素;否则,只有共享边的像素才被视为相邻像素。 |
labelProperty | 字符串,默认值:“label” | 如果不为 null,则第一个波段的值将保存为每个要素的指定属性。 |
crs | 投影,默认值:null | 要使用的投影。如果未指定,则使用映像第一个波段的投影。如果除了缩放比例之外还指定了此参数,则会重新缩放到指定的缩放比例。 |
crsTransform | 列表,默认值:null | CRS 转换值列表。这是 3x2 转换矩阵的行优先顺序。此选项与“scale”互斥,并会替换投影上已设置的所有转换。 |
bestEffort | 布尔值,默认值:false | 如果多边形在给定比例下包含的像素过多,则计算并使用更大的比例,以便操作成功完成。 |
maxPixels | Long,默认值:10000000 | 要减少的最大像素数。 |
tileScale | 浮点数,默认值:1 | 用于减小聚合图块大小的缩放比例;使用较大的 tileScale(例如,2 或 4)可能会启用内存不足的计算(使用默认值)。 |
geometryInNativeProjection | 布尔值,默认值:false | 在像素投影中(而非 EPSG:4326 中)创建几何图形。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eThis function transforms raster images into vector features by grouping similar pixel regions.\u003c/p\u003e\n"],["\u003cp\u003eEach generated feature represents a segment in the image and includes calculated statistics or properties.\u003c/p\u003e\n"],["\u003cp\u003eUsers can customize the analysis by specifying the reducer function, geometry type, and scale.\u003c/p\u003e\n"],["\u003cp\u003eAdvanced options allow control over connectivity, labeling, projection, and memory management for complex processing.\u003c/p\u003e\n"]]],["The `Image.reduceToVectors` function converts an image into a feature collection by grouping homogeneous pixel regions. It uses a reducer to process each region, generating a feature per segment. The function's key actions include applying the reducer over pixel segments, determining feature geometry (polygon, bounding box, or centroid), and handling pixel connectivity. The first image band defines the segments, and the remaining bands provide reducer input. Users can configure scale, projection, pixel adjacency, and manage memory with `maxPixels` and `tileScale`.\n"],null,["# ee.Image.reduceToVectors\n\nConvert an image to a feature collection by reducing homogeneous regions. Given an image containing a band of labeled segments and zero or more additional bands, runs a reducer over the pixels in each segment producing a feature per segment.\n\n\u003cbr /\u003e\n\nEither the reducer must have one fewer inputs than the image has bands, or it must have a single input and will be repeated for each band.\n\n| Usage | Returns |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|\n| Image.reduceToVectors`(`*reducer* `, `*geometry* `, `*scale* `, `*geometryType* `, `*eightConnected* `, `*labelProperty* `, `*crs* `, `*crsTransform* `, `*bestEffort* `, `*maxPixels* `, `*tileScale* `, `*geometryInNativeProjection*`)` | FeatureCollection |\n\n| Argument | Type | Details |\n|------------------------------|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `image` | Image | The input image. The first band is expected to be an integer type; adjacent pixels will be in the same segment if they have the same value in this band. |\n| `reducer` | Reducer, default: null | The reducer to apply. Its inputs will be taken from the image's bands after dropping the first band. Defaults to Reducer.countEvery(). |\n| `geometry` | Geometry, default: null | The region over which to reduce data. Defaults to the footprint of the image's first band. |\n| `scale` | Float, default: null | A nominal scale in meters of the projection to work in. |\n| `geometryType` | String, default: \"polygon\" | How to choose the geometry of each generated feature; one of 'polygon' (a polygon enclosing the pixels in the segment), 'bb' (a rectangle bounding the pixels), or 'centroid' (the centroid of the pixels). |\n| `eightConnected` | Boolean, default: true | If true, diagonally-connected pixels are considered adjacent; otherwise only pixels that share an edge are. |\n| `labelProperty` | String, default: \"label\" | If non-null, the value of the first band will be saved as the specified property of each feature. |\n| `crs` | Projection, default: null | The projection to work in. If unspecified, the projection of the image's first band is used. If specified in addition to scale, rescaled to the specified scale. |\n| `crsTransform` | List, default: null | The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with 'scale', and replaces any transform already set on the projection. |\n| `bestEffort` | Boolean, default: false | If the polygon would contain too many pixels at the given scale, compute and use a larger scale which would allow the operation to succeed. |\n| `maxPixels` | Long, default: 10000000 | The maximum number of pixels to reduce. |\n| `tileScale` | Float, default: 1 | A scaling factor used to reduce aggregation tile size; using a larger tileScale (e.g., 2 or 4) may enable computations that run out of memory with the default. |\n| `geometryInNativeProjection` | Boolean, default: false | Create geometries in the pixel projection, rather than EPSG:4326. |"]]