公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
Method: projects.image.computePixels
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
對圖片資料執行任意運算,藉此計算像素區塊。
每項要求的未壓縮資料大小上限為 48 MB,計算方式為要求的像素尺寸、要求的圖像頻帶數量,以及每個頻帶的位元組數相乘。要求的大小也受到限制,每個維度的像素不得超過 32K,頻帶不得超過 1024 個。如果要求超出這些限制,就會傳回 400 (BAD_REQUEST) 錯誤代碼。
如果成功,回應主體會包含要求的像素資料,並以要求中 fileFormat
欄位指定的編碼方式呈現。
HTTP 要求
POST https://earthengine.googleapis.com/v1/{project=projects/*}/image:computePixels
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
project |
string
應視為此要求服務用戶的 Google Cloud Platform 專案專案 ID 或專案編號。格式為 projects/{project-id} 。
授權需要指定資源 project 的下列 IAM 權限:
earthengine.computations.create
|
要求主體
要求主體的資料會採用以下結構:
欄位 |
expression |
object (Expression )
要計算的運算式。
|
fileFormat |
enum (ImageFileFormat )
用來傳回像素值的輸出檔案格式。
|
grid |
object (PixelGrid )
描述如何重新投影及裁剪由 expression 計算的圖片的參數。如果沒有,系統會以原生投影方式傳回完整的計算圖像。
|
bandIds[] |
string
如果存在,則會指定從評估 expression 的結果中選取特定一組頻帶。如果未指定,系統會選取 expression 產生的所有頻帶。
|
visualizationOptions |
object (VisualizationOptions )
如果存在,則為一組視覺化選項,可用於產生資料的 8 位元 RGB 視覺化。
|
workloadTag |
string
使用者提供的用於追蹤這項運算的代碼。
|
回應主體
如果成功,回應會是一般 HTTP 回應,其格式由方法定義。
授權範圍
需要下列其中一種 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\u003eThe \u003ccode\u003eimage:computePixels\u003c/code\u003e method computes a tile of pixels by performing an arbitrary computation on image data provided as an expression.\u003c/p\u003e\n"],["\u003cp\u003eRequest size is limited to 48MB of uncompressed data, 32K pixels in each dimension, and 1024 bands, with exceeding requests resulting in a 400 (BAD_REQUEST) error.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful responses contain the requested pixel data in the specified file format.\u003c/p\u003e\n"],["\u003cp\u003eUsers can customize output through parameters like \u003ccode\u003efileFormat\u003c/code\u003e, \u003ccode\u003egrid\u003c/code\u003e, \u003ccode\u003ebandIds\u003c/code\u003e, and \u003ccode\u003evisualizationOptions\u003c/code\u003e to control the data format, projection, bands selection, and visualization, respectively.\u003c/p\u003e\n"],["\u003cp\u003eProper authorization with specific OAuth scopes, such as \u003ccode\u003ehttps://www.googleapis.com/auth/earthengine\u003c/code\u003e, is required for accessing this API.\u003c/p\u003e\n"]]],["This content details the process of computing a tile of pixels from image data via a `POST` request to `https://earthengine.googleapis.com/v1/{project=projects/*}/image:computePixels`. Requests specify an `expression`, `fileFormat`, `grid`, optional `bandIds`, `visualizationOptions`, and a `workloadTag`. The request is limited to 48MB of uncompressed data, 32K pixels per dimension, and 1024 bands. Successful responses return requested pixel data in the specified format, with various authorization scopes available.\n"],null,["# Method: projects.image.computePixels\n\nComputes a tile of pixels by performing an arbitrary computation on image data.\n\nRequests 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\nIf successful, the response body contains the requested pixel data in the encoding specified in the `fileFormat` field of the request.\n\n### HTTP request\n\n`POST https://earthengine.googleapis.com/v1/{project=projects/*}/image:computePixels`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `project` | `string` The project id or project number of the Google Cloud Platform project that should be treated as the service consumer for this request. Format is `projects/{project-id}`. Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `project`: - `earthengine.computations.create` |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"expression\": { object (/earth-engine/reference/rest/v1/Expression) }, \"fileFormat\": enum (/earth-engine/reference/rest/v1/ImageFileFormat), \"grid\": { object (/earth-engine/reference/rest/v1/PixelGrid) }, \"bandIds\": [ string ], \"visualizationOptions\": { object (/earth-engine/reference/rest/v1/VisualizationOptions) }, \"workloadTag\": string } ``` |\n\n| Fields ||\n|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `expression` | `object (`[Expression](/earth-engine/reference/rest/v1/Expression)`)` The expression to compute. |\n| `fileFormat` | `enum (`[ImageFileFormat](/earth-engine/reference/rest/v1/ImageFileFormat)`)` The output file format in which to return the pixel values. |\n| `grid` | `object (`[PixelGrid](/earth-engine/reference/rest/v1/PixelGrid)`)` Parameters describing how the image computed by `expression` should be reprojected and clipped. If not present, the full computed image is returned in its native projection. |\n| `bandIds[]` | `string` If present, specifies a specific set of bands that will be selected from the result of evaluating `expression`. If not present, all bands resulting from `expression` will be selected. |\n| `visualizationOptions` | `object (`[VisualizationOptions](/earth-engine/reference/rest/v1/VisualizationOptions)`)` If present, a set of visualization options to apply to produce an 8-bit RGB visualization of the data. |\n| `workloadTag` | `string` User supplied tag to track this computation. |\n\n### Response body\n\nIf successful, the response is a generic HTTP response whose format is defined by the method.\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)."]]