公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
Method: projects.thumbnails.create
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
建立可用於算繪「縮圖」圖片的 ID。
此選項會與 thumbnails.getPixels
搭配使用。呼叫 thumbnails.create
會提供運算式和一些輸出選項。thumbnails.create
的結果是代表圖片的 ID,該 ID 是評估該運算式並套用這些選項的結果。接著,您可以呼叫 thumbnails.getPixels
,取得整個產生圖片的圖片資料。ID 的有效時間為數小時。
這組端點最常見的用途是透過 POST 至 thumbnails.create
提供複雜的運算式,然後透過 GET 至 thumbnails.getPixels
擷取已計算的圖片。這個兩階段程序比 ComputePixels
更適合用於更多情況。具體來說:- ComputePixels
的結果需要展開,才能取得已編碼的圖片位元組。瀏覽器可以直接顯示 thumbnails.getPixels
的結果。- ComputePixels
只能由已授權的使用者使用適當範圍的 OAuth 權杖呼叫。thumbnails.create
有相同的限制,但 thumbnails.getPixels
可透過含有 API 金鑰的網址叫用,因此叫用它的網址可更廣泛地使用。
評估運算式的結果必須符合要求的圖片格式的一些合理規定。具體來說,JPEG 或 PNG 格式需要一或三個輸出頻帶,以及超出 0 到 255 範圍的剪輯值。
「縮圖」說明並未限制所產生圖片的大小:ComputePixels
的限制也適用於 thumbnails.create
/thumbnails.getPixels
。每個要求的未壓縮資料大小上限為 48 MB,計算方式為要求的像素尺寸、要求的圖像頻帶數量,以及每個頻帶的每個像素位元組數量乘積。要求的大小也受到限制,每個維度的像素不得超過 32K,頻帶不得超過 1024 個。如果要求超出這些限制,就會傳回 400 (BAD_REQUEST) 錯誤代碼。
HTTP 要求
POST https://earthengine.googleapis.com/v1/{parent=projects/*}/thumbnails
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
parent |
string
必要欄位。縮圖集合的父項 (例如「projects/*」)。
授權需要指定資源 parent 的下列 IAM 權限:
earthengine.thumbnails.create
|
查詢參數
參數 |
workloadTag |
string
使用者提供的用於追蹤這項運算的代碼。
|
要求主體
要求主體包含 Thumbnail
的例項。
回應主體
如果成功,回應主體會包含新建立的 Thumbnail
例項。
授權範圍
需要下列其中一種 OAuth 範圍:
https://www.googleapis.com/auth/earthengine
https://www.googleapis.com/auth/earthengine.readonly
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/cloud-platform.read-only
詳情請參閱 OAuth 2.0 Overview。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003ethumbnails.create\u003c/code\u003e generates an ID representing an image created from a provided expression and output options, which can then be used with \u003ccode\u003ethumbnails.getPixels\u003c/code\u003e to retrieve the image data.\u003c/p\u003e\n"],["\u003cp\u003eThis two-step approach enables broader usage scenarios, including direct browser display and API key-based access for \u003ccode\u003ethumbnails.getPixels\u003c/code\u003e, compared to \u003ccode\u003eComputePixels\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhile called "thumbnail," the generated images are subject to the same size and format constraints as \u003ccode\u003eComputePixels\u003c/code\u003e, including limits on dimensions, bands, and data size.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization for \u003ccode\u003ethumbnails.create\u003c/code\u003e requires specific IAM permissions, while \u003ccode\u003ethumbnails.getPixels\u003c/code\u003e can be invoked with an API key for wider accessibility.\u003c/p\u003e\n"],["\u003cp\u003eThe resulting image format must meet certain requirements, such as having one or three output bands and clipping values for JPEG or PNG formats.\u003c/p\u003e\n"]]],["`thumbnails.create` generates an ID representing an image derived from an expression and output options. `thumbnails.getPixels`, using this ID, retrieves the image data. This two-part process allows for broader use compared to `ComputePixels` as `thumbnails.getPixels` can use an API key in the URL, while both methods are limited to 48MB of uncompressed data per request. Valid output formats such as JPEG or PNG must follow output band constraints and value ranges.\n"],null,["# Method: projects.thumbnails.create\n\nCreates an ID that can be used to render a \"thumbnail\" image.\n\nThis is used in conjunction with `thumbnails.getPixels`. A call to `thumbnails.create` provides an expression and some output options. The result of `thumbnails.create` is an ID that represents an image that is the result of evaluating that expression and applying those options. Subsequently, calls to `thumbnails.getPixels` can be made to get the image data for the entire resulting image. The ID will be valid for a moderate period (a few hours).\n\nThe most common use case for this pair of endpoints is to provide a complex expression via a POST to `thumbnails.create`, and then fetch the computed image via a GET to `thumbnails.getPixels`. This two-part process allows for use in more situations than `ComputePixels`. In particular: - the result of `ComputePixels` needs to be unwrapped to get the encoded image bytes. The result of `thumbnails.getPixels` can be displayed directly by a browser. - `ComputePixels` can only be called by an authorised user, using a properly-scoped OAuth token. `thumbnails.create` has the same restriction, but `thumbnails.getPixels` can be invoked with a URL containing an API key, so URLs invoking it can be used more broadly.\n\nThe result of evaluating the expression has to meet some reasonable requirements for the requested image format. In particular, JPEG or PNG format requires that there be one or three output bands, and clips values that are outside the 0-255 range.\n\nThe description \"thumbnail\" does not imply a restriction on the size of the computed image: the same restrictions as `ComputePixels` apply to `thumbnails.create`/`thumbnails.getPixels`. Requests are limited to 48MB in uncompressed data per request, computed as the product of the request dimensions in pixels, the number of image bands requested, and the number of bytes per pixel for each band. Requests are also limited to at most 32K pixels in either dimension and at most 1024 bands. Requests exceeding these limits will result in an error code of 400 (BAD_REQUEST).\n\n### HTTP request\n\n`POST https://earthengine.googleapis.com/v1/{parent=projects/*}/thumbnails`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` Required. The parent of the thumbnail collection (e.g., \"projects/\\*\"). Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `parent`: - `earthengine.thumbnails.create` |\n\n### Query parameters\n\n| Parameters ||\n|---------------|-------------------------------------------------------|\n| `workloadTag` | `string` User supplied tag to track this computation. |\n\n### Request body\n\nThe request body contains an instance of [Thumbnail](/earth-engine/reference/rest/v1/projects.locations.thumbnails#Thumbnail).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Thumbnail](/earth-engine/reference/rest/v1/projects.locations.thumbnails#Thumbnail).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/earthengine`\n- `\n https://www.googleapis.com/auth/earthengine.readonly`\n- `\n https://www.googleapis.com/auth/cloud-platform`\n- `\n https://www.googleapis.com/auth/cloud-platform.read-only`\n\nFor more information, see the [OAuth 2.0 Overview](/identity/protocols/OAuth2)."]]