Method: projects.assets.getPixels
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ìm nạp pixel từ một thành phần hình ảnh. Phương thức tuỳ chỉnh này cho phép phương thức gọi yêu cầu một ô pixel tuỳ ý từ một hình ảnh, tuỳ ý chỉ định các dải và phép chiếu bản đồ. Dữ liệu bị che hoặc bị thiếu sẽ được mã hoá thành số 0.
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).
Nếu thành công, nội dung phản hồi sẽ chứa dữ liệu pixel được yêu cầu theo cách mã hoá được chỉ định trong trường fileFormat
của yêu cầu.
Yêu cầu HTTP
POST https://earthengine.googleapis.com/v1alpha/{name=projects/*/assets/**}:getPixels
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Thông số |
name |
string
Bắt buộc. Tên của thành phần hình ảnh để lấy pixel. name có định dạng "projects/*/assets/**" (ví dụ: "projects/earthengine-legacy/assets/users/[USER]/[ASSET]"). Tất cả tài sản do người dùng sở hữu đều thuộc dự án "earthengine-legacy" (ví dụ: "projects/earthengine-legacy/assets/users/foo/bar"). Tất cả các tài sản khác đều thuộc dự án "earthengine-public" (ví dụ: "projects/earthengine-public/assets/LANDSAT").
Việc uỷ quyền yêu cầu quyền IAM sau đây trên tài nguyên name đã chỉ định:
|
Nội dung yêu cầu
Nội dung yêu cầu chứa dữ liệu có cấu trúc sau:
Biểu diễn dưới dạng JSON |
{
"fileFormat": enum (ImageFileFormat ),
"grid": {
object (PixelGrid )
},
"region": {
object
},
"bandIds": [
string
],
"visualizationOptions": {
object (VisualizationOptions )
},
"workloadTag": string
} |
Trường |
fileFormat |
enum (ImageFileFormat )
Định dạng tệp đầu ra để trả về các giá trị pixel.
|
grid |
object (PixelGrid )
Các tham số mô tả lưới pixel để tìm nạp dữ liệu. Mặc định là lưới pixel gốc của dữ liệu.
|
region |
object (Struct format)
Nếu có, vùng dữ liệu cần trả về, được chỉ định dưới dạng đối tượng hình học GeoJSON (xem RFC 7946). Vì hình ảnh được trả về luôn có hình chữ nhật, nên hộp giới hạn của hình học đã cho trong hệ toạ độ đầu ra sẽ được sử dụng. Nếu bạn cũng chỉ định grid.dimensions , thì lưới sẽ được điều chỉnh theo tỷ lệ thành kích thước được yêu cầu.
|
bandIds[] |
string
Nếu có, hãy chỉ định một nhóm băng cụ thể để lấy pixel. Các dải được xác định bằng mã nhận dạng, như được chỉ ra trong trường id của nguyên mẫu ImageBand.
|
visualizationOptions |
object (VisualizationOptions )
Nếu có, một tập hợp các tuỳ chọn trực quan hoá để áp dụng nhằm tạo hình ảnh trực quan RGB 8 bit của dữ liệu, thay vì trả về dữ liệu thô.
|
workloadTag |
string
Thẻ do người dùng cung cấp để theo dõi phép tính này.
|
Nội dung phản hồi
Nếu thành công, phản hồi sẽ là một phản hồi HTTP chung có định dạng do phương thức xác định.
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\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)."]]