Method: projects.thumbnails.create
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Tworzy identyfikator, który można wykorzystać do renderowania obrazu „miniatura”.
Jest on używany w połączeniu z atrybutem thumbnails.getPixels
. Wywołanie funkcji thumbnails.create
udostępnia wyrażenie i niektóre opcje wyjścia. Wynik funkcji thumbnails.create
to identyfikator, który reprezentuje obraz będący wynikiem oceny tego wyrażenia i zastosowania tych opcji. Następnie można wywołać metodę thumbnails.getPixels
, aby uzyskać dane obrazu dla całego wynikowego obrazu. Dokument tożsamości będzie ważny przez pewien czas (kilka godzin).
Najczęstszym zastosowaniem tej pary punktów końcowych jest podanie złożonego wyrażenia za pomocą metody POST na adres thumbnails.create
, a następnie pobranie obliczonych obrazów za pomocą metody GET na adres thumbnails.getPixels
. Ten dwuetapowy proces pozwala na wykorzystanie w większej liczbie sytuacji niż ComputePixels
. W szczególności: – wynik funkcji ComputePixels
musi zostać odwinięty, aby uzyskać zakodowane bajty obrazu. Wynik funkcji thumbnails.getPixels
może być wyświetlany bezpośrednio przez przeglądarkę. – ComputePixels
może wywołać tylko autoryzowany użytkownik, używając tokena OAuth o odpowiednim zakresie. thumbnails.create
ma takie samo ograniczenie, ale thumbnails.getPixels
może być wywoływany za pomocą adresu URL zawierającego klucz interfejsu API, więc adresy URL wywołujące tę funkcję mogą być używane szerzej.
Wynik oceny wyrażenia musi spełniać określone wymagania dotyczące żądanego formatu obrazu. W szczególności formaty JPEG lub PNG wymagają 1 lub 3 pasm wyjściowych oraz wartości przycinania, które wykraczają poza zakres 0–255.
Opis „miniatura” nie oznacza ograniczenia rozmiaru obliczonych obrazów: do thumbnails.create
/thumbnails.getPixels
mają zastosowanie te same ograniczenia co do ComputePixels
. Żądania są ograniczone do 48 MB nieskompresowanych danych na żądanie, obliczanych jako iloczyn wymiarów żądania w pikselach, liczby żądanych pasm obrazu i liczby bajtów na piksel dla każdego pasma. Żądania są też ograniczone do maksymalnie 32 tys. pikseli w każdym wymiarze i maksymalnie 1024 pasm. Żądania przekraczające te limity będą skutkować kodem błędu 400 (BAD_REQUEST).
Żądanie HTTP
POST https://earthengine.googleapis.com/v1/{parent=projects/*}/thumbnails
Adres URL używa składni transkodowania gRPC.
Parametry ścieżki
Parametry |
parent |
string
Wymagany. Nadrzędny element kolekcji miniatur (np. „projects/*)”.
Autoryzacja wymaga tych uprawnień IAM w przypadku określonego zasobu: parent
earthengine.thumbnails.create
|
Parametry zapytania
Parametry |
workloadTag |
string
Tag dostarczony przez użytkownika do śledzenia tego obliczenia.
|
Treść żądania
Treść żądania zawiera wystąpienie elementu Thumbnail
.
Treść odpowiedzi
Jeśli operacja się powiedzie, treść odpowiedzi będzie zawierała nowo utworzoną instancję Thumbnail
.
Zakresy autoryzacji
Wymaga jednego z tych zakresów 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
Więcej informacji znajdziesz w OAuth 2.0 Overview.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-25 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-25 UTC."],[[["\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)."]]