公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
Method: projects.value.compute
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
計算任意值。如果運算式的結果無法以值表示,或是其評估需要太多資源,這項作業就會失敗。雖然在這裡運算任何類型的物件都不會發生錯誤,但一般來說,如果運算結果更適合其他 Compute* 端點,則應改用該端點 (例如,如果運算結果是一系列功能,則應改用 ComputeFeatures)。
HTTP 要求
POST https://earthengine.googleapis.com/v1alpha/{project=projects/*}/value:compute
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
project |
string
應視為此要求服務用戶的 Google Cloud Platform 專案專案 ID 或專案編號。格式為 projects/{project-id} 。
授權需要指定資源 project 的下列 IAM 權限:
earthengine.computations.create
|
要求主體
要求主體的資料會採用以下結構:
JSON 表示法 |
{
"expression": {
object (Expression )
},
"workloadTag": string
} |
欄位 |
expression |
object (Expression )
要計算的運算式。
|
workloadTag |
string
使用者提供的用於追蹤這項運算的代碼。
|
回應主體
任意運算的結果。
如果成功,回應主體會含有以下結構的資料:
JSON 表示法 |
{
"result": value
} |
欄位 |
result |
value (Value format)
計算運算式值的結果。
|
授權範圍
需要下列其中一種 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\u003eComputes an arbitrary value based on a provided expression using the Earth Engine API.\u003c/p\u003e\n"],["\u003cp\u003eUtilizes the \u003ccode\u003ePOST\u003c/code\u003e method and requires specifying the project ID in the URL.\u003c/p\u003e\n"],["\u003cp\u003eRequest body includes the expression to compute and an optional workload tag for tracking.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful responses contain the computed value in a structured format.\u003c/p\u003e\n"],["\u003cp\u003eRequires specific OAuth scopes for authorization, like \u003ccode\u003ehttps://www.googleapis.com/auth/earthengine\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `compute` endpoint evaluates an arbitrary expression, returning its result as a `Value`. A POST request is made to `https://earthengine.googleapis.com/v1alpha/{project=projects/*}/value:compute`, requiring `earthengine.computations.create` IAM permission. The request body contains the `expression` to compute and an optional `workloadTag`. The response returns the `result` of the computation in `Value` format, and requires one of the provided OAuth scopes for authorization. Other `Compute*` endpoints should be used if they are better suited for the task.\n"],null,["# Method: projects.value.compute\n\nComputes an arbitrary value. This will fail if the result of the Expression is not something that is expressible as a Value, or if its evaluation requires too many resources. While it is possible (and not an error) to compute any type of object here, in general any Expression producing results that are better suited to one of the other Compute\\* endpoints should use that endpoint instead (e.g., an Expression whose result is a set of features should use ComputeFeatures).\n\n### HTTP request\n\n`POST https://earthengine.googleapis.com/v1alpha/{project=projects/*}/value:compute`\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/v1alpha/Expression) }, \"workloadTag\": string } ``` |\n\n| Fields ||\n|---------------|-------------------------------------------------------------------------------------------------------|\n| `expression` | `object (`[Expression](/earth-engine/reference/rest/v1alpha/Expression)`)` The expression to compute. |\n| `workloadTag` | `string` User supplied tag to track this computation. |\n\n### Response body\n\nThe results of an arbitrary computation.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|-----------------------------|\n| ``` { \"result\": value } ``` |\n\n| Fields ||\n|----------|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| `result` | `value (`[Value](https://protobuf.dev/reference/protobuf/google.protobuf/#value)` format)` The results of computing the value of the expression. |\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)."]]