公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
ee.Image.paint
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
:使用指定的「顏色」值,將集合的幾何圖形繪製到圖片上,以取代任何幾何圖形涵蓋圖片的每個波段值 (或如果指定線寬,則為周邊)。
這個演算法最適合將特徵屬性的類別資料轉換為圖片中的像素;如要將集合視覺化,請改用 FeatureCollection.style,這個演算法支援 RGB 顏色,但嚴格來說是「單色」(使用單一數值)。
用量 | 傳回 |
---|
Image.paint(featureCollection, color, width) | 圖片 |
引數 | 類型 | 詳細資料 |
---|
這個:image | 圖片 | 要繪製收藏內容的圖片。 |
featureCollection | FeatureCollection | 圖片上繪製的集合。 |
color | 物件,預設值為 0 | 要繪製到輸入圖片每個波段的像素值,可以是將用於所有特徵的數字,也可以是要從集合中每個特徵取得的數字屬性名稱。 |
width | 物件,預設值:null | 線寬,可以是所有幾何圖形的線寬 (以數字表示),也可以是集合中每個特徵的數值屬性名稱。如未指定,幾何圖形會填滿而非顯示輪廓。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003ePaints geometries from a FeatureCollection onto an image, replacing pixel values with a specified color or property value where geometries overlap.\u003c/p\u003e\n"],["\u003cp\u003eIdeal for converting categorical feature data to image pixels, offering a monochrome visualization.\u003c/p\u003e\n"],["\u003cp\u003eOffers options to fill geometries or outline them using a specified line width, which can be uniform or vary based on feature properties.\u003c/p\u003e\n"],["\u003cp\u003eUses a single color value for all bands of the image, making it suitable for thematic mapping and data representation rather than visual styling.\u003c/p\u003e\n"],["\u003cp\u003eFor visualizing collections with RGB colors and more styling options, FeatureCollection.style is recommended as a more suitable alternative.\u003c/p\u003e\n"]]],[],null,["# ee.Image.paint\n\nPaints the geometries of a collection onto an image, using the given 'color' value to replace each band's values where any geometry covers the image (or, if a line width is specified, where the perimeters do).\n\n\u003cbr /\u003e\n\nThis algorithm is most suitable for converting categorical data from feature properties to pixels in an image; if you wish to visualize a collection, consider using FeatureCollection.style instead, which supports RGB colors whereas this algorithm is strictly 'monochrome' (using single numeric values).\n\n| Usage | Returns |\n|---------------------------------------------------------|---------|\n| Image.paint`(featureCollection, `*color* `, `*width*`)` | Image |\n\n| Argument | Type | Details |\n|---------------------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `image` | Image | The image on which the collection is painted. |\n| `featureCollection` | FeatureCollection | The collection painted onto the image. |\n| `color` | Object, default: 0 | The pixel value to paint into every band of the input image, either as a number which will be used for all features, or the name of a numeric property to take from each feature in the collection. |\n| `width` | Object, default: null | Line width, either as a number which will be the line width for all geometries, or the name of a numeric property to take from each feature in the collection. If unspecified, the geometries will be filled instead of outlined. |"]]