公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
Method: projects.image.computePixels
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
通过对图片数据执行任意计算来计算一块像素。
每个请求的未压缩数据量限制为 48MB,计算方式为请求尺寸(以像素为单位)、请求的图像波段数以及每个波段的每个像素字节数的乘积。请求的任一尺寸不得超过 32K 像素,且不得超过 1024 个波段。超出这些限制的请求将导致错误代码为 400 (BAD_REQUEST)。
如果成功,响应正文将包含请求的像素数据,采用请求的 fileFormat
字段中指定的编码。
HTTP 请求
POST https://earthengine.googleapis.com/v1alpha/{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。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eThis API computes a tile of pixels by performing a calculation on image data, returning the pixel data in a specified file format.\u003c/p\u003e\n"],["\u003cp\u003eRequests are restricted to 48MB of uncompressed data, 32K pixels in each dimension, and 1024 bands, with larger requests resulting in errors.\u003c/p\u003e\n"],["\u003cp\u003eUsers specify an expression, output format, and optional reprojection/clipping, band selection, and visualization options.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication is required using specific OAuth scopes like \u003ccode\u003ehttps://www.googleapis.com/auth/earthengine\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful responses contain the requested pixel data encoded as specified, delivered via a generic HTTP response format.\u003c/p\u003e\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/v1alpha/{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/v1alpha/Expression) }, \"fileFormat\": enum (/earth-engine/reference/rest/v1alpha/ImageFileFormat), \"grid\": { object (/earth-engine/reference/rest/v1alpha/PixelGrid) }, \"bandIds\": [ string ], \"visualizationOptions\": { object (/earth-engine/reference/rest/v1alpha/VisualizationOptions) }, \"workloadTag\": string } ``` |\n\n| Fields ||\n|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `expression` | `object (`[Expression](/earth-engine/reference/rest/v1alpha/Expression)`)` The expression to compute. |\n| `fileFormat` | `enum (`[ImageFileFormat](/earth-engine/reference/rest/v1alpha/ImageFileFormat)`)` The output file format in which to return the pixel values. |\n| `grid` | `object (`[PixelGrid](/earth-engine/reference/rest/v1alpha/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/v1alpha/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)."]]