公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
Method: projects.thumbnails.create
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
创建一个 ID,用于呈现“缩略图”图片。
此属性与 thumbnails.getPixels
结合使用。调用 thumbnails.create
会提供一个表达式和一些输出选项。thumbnails.create
的结果是一个 ID,表示在对该表达式求值并应用这些选项后得到的图片。随后,可以调用 thumbnails.getPixels
来获取整个生成图片的图片数据。该 ID 的有效期为中等时间(几小时)。
这对端点的最常见用例是通过 POST 向 thumbnails.create
提供复杂表达式,然后通过 GET 向 thumbnails.getPixels
提取计算的图片。与 ComputePixels
相比,这种两步流程可在更多情况下使用。具体而言:- 需要解封装 ComputePixels
的结果,才能获取编码的图片字节。浏览器可以直接显示 thumbnails.getPixels
的结果。- 只有已获授权的用户才能使用范围适当的 OAuth 令牌调用 ComputePixels
。thumbnails.create
也存在相同的限制,但可以使用包含 API 密钥的网址调用 thumbnails.getPixels
,因此调用它的网址可以更广泛地使用。
对表达式求值的结果必须满足对请求的图片格式的一些合理要求。具体而言,JPEG 或 PNG 格式要求有 1 个或 3 个输出波段,并且剪裁值超出 0-255 范围。
说明“缩略图”并不意味着对计算图片的大小有限制:thumbnails.create
/thumbnails.getPixels
适用与 ComputePixels
相同的限制。每个请求的未压缩数据量上限为 48MB,计算方法为请求尺寸(以像素为单位)、请求的图像波段数以及每个波段的每个像素字节数的乘积。请求的任一尺寸不得超过 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。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):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)."]]