Annuncio: tutti i progetti non commerciali registrati per l'utilizzo di Earth Engine prima del
15 aprile 2025 devono
verificare l'idoneità non commerciale per mantenere l'accesso a Earth Engine.
Method: projects.assets.getPixels
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Recupera i pixel da un asset immagine. Questo metodo personalizzato consente all'utente chiamante di richiedere un riquadro arbitrario di pixel da un'immagine, specificando facoltativamente le bande e la proiezione della mappa. I dati mascherati o mancanti verranno codificati come zeri.
Le richieste sono limitate a 48 MB di dati non compressi per richiesta, calcolati come prodotto delle dimensioni della richiesta in pixel, del numero di bande di immagini richieste e del numero di byte per pixel per ogni banda. Le richieste sono inoltre limitate a un massimo di 32.000 pixel in entrambe le dimensioni e a un massimo di 1024 bande. Le richieste che superano questi limiti restituiranno un codice di errore 400 (BAD_REQUEST).
In caso di esito positivo, il corpo della risposta contiene i dati dei pixel richiesti nella codifica specificata nel campo fileFormat
della richiesta.
Richiesta HTTP
POST https://earthengine.googleapis.com/v1alpha/{name=projects/*/assets/**}:getPixels
L'URL utilizza la sintassi di transcodifica gRPC.
Parametri del percorso
Parametri |
name |
string
Obbligatorio. Il nome dell'asset immagine da cui ottenere i pixel. name sia nel formato "projects/*/assets/**" (ad es. "projects/earthengine-legacy/assets/users/[USER]/[ASSET]"). Tutti gli asset di proprietà dell'utente si trovano nel progetto "earthengine-legacy" (ad es. "projects/earthengine-legacy/assets/users/foo/bar"). Tutti gli altri asset si trovano nel progetto "earthengine-public" (ad es. "projects/earthengine-public/assets/LANDSAT").
L'autorizzazione richiede la seguente autorizzazione IAM sulla risorsa specificata name :
|
Corpo della richiesta
Il corpo della richiesta contiene dati con la seguente struttura:
Rappresentazione JSON |
{
"fileFormat": enum (ImageFileFormat ),
"grid": {
object (PixelGrid )
},
"region": {
object
},
"bandIds": [
string
],
"visualizationOptions": {
object (VisualizationOptions )
},
"workloadTag": string
} |
Campi |
fileFormat |
enum (ImageFileFormat )
Il formato file di output in cui restituire i valori dei pixel.
|
grid |
object (PixelGrid )
Parametri che descrivono la griglia di pixel in cui recuperare i dati. Il valore predefinito è la griglia di pixel nativa dei dati.
|
region |
object (Struct format)
Se presente, la regione di dati da restituire, specificata come oggetto geometria GeoJSON (vedi RFC 7946). Poiché l'immagine restituita è sempre rettangolare, verrà effettivamente utilizzata la scatola delimitante della geometria specificata nel sistema di coordinate di output. Se viene specificato anche grid.dimensions , la griglia verrà infine riscalata alle dimensioni richieste.
|
bandIds[] |
string
Se presente, specifica un insieme specifico di bande da cui ottenere i pixel. Le bande sono identificate dall'ID, come indicato dal campo id di un proto ImageBand.
|
visualizationOptions |
object (VisualizationOptions )
Se presente, un insieme di opzioni di visualizzazione da applicare per produrre una visualizzazione RGB a 8 bit dei dati anziché restituire i dati non elaborati.
|
workloadTag |
string
Tag fornito dall'utente per monitorare questo calcolo.
|
Corpo della risposta
In caso di esito positivo, la risposta è una risposta HTTP generica il cui formato è definito dal metodo.
Ambiti di autorizzazione
Richiede uno dei seguenti ambiti 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
Per ulteriori informazioni, consulta la sezione OAuth 2.0 Overview.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-25 UTC.
[null,null,["Ultimo aggiornamento 2025-07-25 UTC."],[[["\u003cp\u003eFetches pixel data from Earth Engine image assets, allowing users to specify desired regions, bands, and output formats.\u003c/p\u003e\n"],["\u003cp\u003eRequests are limited to 48MB of uncompressed data, 32K pixels in each dimension, and 1024 bands; exceeding these limits will result in a 400 error.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful responses contain the requested pixel data in the specified file format, or an 8-bit RGB visualization if visualization options are provided.\u003c/p\u003e\n"],["\u003cp\u003eThe request must specify the image asset name and can optionally include parameters for the output format, pixel grid, region, bands, visualization options, and a workload tag for tracking.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization requires appropriate IAM permissions or one of the specified OAuth scopes, including 'earthengine', 'earthengine.readonly', 'cloud-platform', or 'cloud-platform.read-only'.\u003c/p\u003e\n"]]],[],null,["# Method: projects.assets.getPixels\n\nFetches pixels from an image asset. This custom method allows the caller to request an arbitrary tile of pixels from an image, optionally specifying the bands and map projection. Masked or missing data will be encoded as zeroes.\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/{name=projects/*/assets/**}:getPixels`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Required. The name of the image asset from which to get pixels. `name` is of the format \"projects/\\*/assets/\\*\\*\" (e.g., \"projects/earthengine-legacy/assets/users/\\[USER\\]/\\[ASSET\\]\"). All user-owned assets are under the project \"earthengine-legacy\" (e.g., \"projects/earthengine-legacy/assets/users/foo/bar\"). All other assets are under the project \"earthengine-public\" (e.g., \"projects/earthengine-public/assets/LANDSAT\"). Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `name`: - `earthengine.assets.get` |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"fileFormat\": enum (/earth-engine/reference/rest/v1alpha/ImageFileFormat), \"grid\": { object (/earth-engine/reference/rest/v1alpha/PixelGrid) }, \"region\": { object }, \"bandIds\": [ string ], \"visualizationOptions\": { object (/earth-engine/reference/rest/v1alpha/VisualizationOptions) }, \"workloadTag\": string } ``` |\n\n| Fields ||\n|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\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 the pixel grid in which to fetch data. Defaults to the native pixel grid of the data. |\n| `region` | `object (`[Struct](https://protobuf.dev/reference/protobuf/google.protobuf/#struct)` format)` If present, the region of data to return, specified as a GeoJSON geometry object (see RFC 7946). Since the returned image is always rectangular, the bounding box of the given geometry in the output coordinate system will actually be used. If `grid.dimensions` is also specified then the grid will finally be rescaled to the requested size. |\n| `bandIds[]` | `string` If present, specifies a specific set of bands from which to get pixels. Bands are identified by id, as indicated by the `id` field of an ImageBand proto. |\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, rather than returning the raw 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)."]]