公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
ee.Image.reduceToVectors
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
減少同質區域,將圖像轉換為特徵集合。如果圖片包含標示區隔的帶狀區域,以及零或多個額外帶狀區域,系統會對每個區隔中的像素執行縮減器,為每個區隔產生特徵。
還原器必須比圖片的波段少一個輸入內容,或是只有一個輸入內容,並針對每個波段重複執行。
用量 | 傳回 |
---|
Image.reduceToVectors(reducer, geometry, scale, geometryType, eightConnected, labelProperty, crs, crsTransform, bestEffort, maxPixels, tileScale, geometryInNativeProjection) | FeatureCollection |
引數 | 類型 | 詳細資料 |
---|
這個:image | 圖片 | 輸入圖片。第一個波段應為整數型別;如果相鄰像素在這個波段中具有相同值,就會位於同一區段。 |
reducer | Reducer,預設值:null | 要套用的縮減函式。在捨棄第一個頻帶後,系統會從圖片的頻帶取得輸入內容。預設值為 Reducer.countEvery()。 |
geometry | 幾何圖形,預設值:null | 要減少資料的區域。預設為圖片第一個波段的足跡。 |
scale | 浮點值,預設值為空值 | 以公尺為單位的投影名義比例,用於工作。 |
geometryType | 字串,預設值為「polygon」 | 如何選擇每個生成特徵的幾何圖形;可以是「polygon」(封閉區段中像素的多邊形)、「bb」(像素的定界矩形) 或「centroid」(像素的質心)。 |
eightConnected | 布林值,預設值為 true | 如為 true,系統會將對角線相連的像素視為相鄰;否則,只有共用邊緣的像素才會視為相鄰。 |
labelProperty | 字串,預設值為「label」 | 如果不是空值,第一個波段的值會儲存為每個特徵的指定屬性。 |
crs | 投影,預設值:null | 要使用的投影機。如未指定,系統會使用圖片第一個波段的投影。如果除了比例外還指定了其他值,系統會重新調整為指定比例。 |
crsTransform | 清單,預設值為空值 | CRS 轉換值清單。這是 3x2 轉換矩陣的列優先順序。這個選項與「scale」互斥,且會取代投影上已設定的任何變形。 |
bestEffort | 布林值,預設值為 false | 如果多邊形在指定比例下包含的像素過多,請計算並使用較大的比例,這樣作業就能成功。 |
maxPixels | Long,預設值:10000000 | 要減少的像素數量上限。 |
tileScale | 浮點值,預設值為 1 | 用於縮小聚合圖塊大小的縮放比例因數;使用較大的 tileScale (例如 2 或 4) 可能會啟用運算,導致記憶體不足。 |
geometryInNativeProjection | 布林值,預設值為 false | 在像素投影中建立幾何圖形,而非 EPSG:4326。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間: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. |"]]