Method: projects.thumbnails.create
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tạo một mã nhận dạng có thể dùng để hiển thị hình ảnh "hình thu nhỏ".
Phương thức này được dùng cùng với thumbnails.getPixels
. Lệnh gọi đến thumbnails.create
cung cấp một biểu thức và một số tuỳ chọn đầu ra. Kết quả của thumbnails.create
là một mã nhận dạng đại diện cho hình ảnh là kết quả của việc đánh giá biểu thức đó và áp dụng các tuỳ chọn đó. Sau đó, bạn có thể thực hiện lệnh gọi đến thumbnails.getPixels
để lấy dữ liệu hình ảnh cho toàn bộ hình ảnh thu được. Giấy tờ tuỳ thân này sẽ có hiệu lực trong một khoảng thời gian vừa phải (vài giờ).
Trường hợp sử dụng phổ biến nhất cho cặp điểm cuối này là cung cấp một biểu thức phức tạp thông qua một yêu cầu POST đến thumbnails.create
, sau đó tìm nạp hình ảnh được tính toán thông qua một yêu cầu GET đến thumbnails.getPixels
. Quy trình hai phần này cho phép sử dụng trong nhiều trường hợp hơn so với ComputePixels
. Cụ thể: – kết quả của ComputePixels
cần được mở gói để lấy các byte hình ảnh đã mã hoá. Trình duyệt có thể hiển thị trực tiếp kết quả của thumbnails.getPixels
. – Chỉ người dùng được uỷ quyền mới có thể gọi ComputePixels
bằng mã thông báo OAuth có phạm vi thích hợp. thumbnails.create
có cùng quy định hạn chế, nhưng thumbnails.getPixels
có thể được gọi bằng một URL chứa khoá API, vì vậy, các URL gọi API này có thể được sử dụng rộng rãi hơn.
Kết quả của việc đánh giá biểu thức phải đáp ứng một số yêu cầu hợp lý đối với định dạng hình ảnh được yêu cầu. Cụ thể, định dạng JPEG hoặc PNG yêu cầu phải có một hoặc ba dải đầu ra và các giá trị clip nằm ngoài phạm vi 0-255.
Nội dung mô tả "hình thu nhỏ" không ngụ ý giới hạn về kích thước của hình ảnh được tính toán: các giới hạn giống như ComputePixels
áp dụng cho thumbnails.create
/thumbnails.getPixels
. Mỗi yêu cầu được giới hạn ở 48 MB dữ liệu không nén, được tính bằng tích của kích thước yêu cầu tính bằng pixel, số dải hình ảnh được yêu cầu và số byte trên mỗi pixel cho mỗi dải. Các yêu cầu cũng bị giới hạn ở tối đa 32K pixel theo một trong hai kích thước và tối đa 1024 băng tần. Các yêu cầu vượt quá các giới hạn này sẽ dẫn đến mã lỗi 400 (BAD_REQUEST).
Yêu cầu HTTP
POST https://earthengine.googleapis.com/v1alpha/{parent=projects/*}/thumbnails
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Thông số |
parent |
string
Bắt buộc. Phần tử mẹ của bộ sưu tập hình thu nhỏ (ví dụ: "projects/*").
Việc uỷ quyền yêu cầu quyền IAM sau đây trên tài nguyên parent đã chỉ định:
earthengine.thumbnails.create
|
Tham số truy vấn
Thông số |
workloadTag |
string
Thẻ do người dùng cung cấp để theo dõi phép tính này.
|
Nội dung yêu cầu
Nội dung yêu cầu chứa một bản sao của Thumbnail
.
Nội dung phản hồi
Nếu thành công, nội dung phản hồi sẽ chứa một thực thể Thumbnail
mới tạo.
Phạm vi uỷ quyền
Yêu cầu một trong các phạm vi OAuth sau:
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
Để biết thêm thông tin, hãy xem OAuth 2.0 Overview.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003e\u003ccode\u003ethumbnails.create\u003c/code\u003e generates an ID representing an image created from an expression and output options, usable with \u003ccode\u003ethumbnails.getPixels\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ethumbnails.getPixels\u003c/code\u003e retrieves image data using the ID from \u003ccode\u003ethumbnails.create\u003c/code\u003e, offering broader usage than \u003ccode\u003eComputePixels\u003c/code\u003e due to API key accessibility.\u003c/p\u003e\n"],["\u003cp\u003eThe resulting image must adhere to format requirements (e.g., JPEG/PNG need 1-3 bands, values within 0-255).\u003c/p\u003e\n"],["\u003cp\u003eWhile called "thumbnail", image size is subject to the same limits as \u003ccode\u003eComputePixels\u003c/code\u003e, with restrictions on dimensions, bands, and data size to prevent errors.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves a POST request to \u003ccode\u003ethumbnails.create\u003c/code\u003e to provide the expression, followed by a GET request to \u003ccode\u003ethumbnails.getPixels\u003c/code\u003e to fetch the image.\u003c/p\u003e\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/v1alpha/{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/v1alpha/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/v1alpha/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)."]]