Method: projects.assets.getPixels
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ดึงข้อมูลพิกเซลจากชิ้นงานรูปภาพ เมธอดที่กําหนดเองนี้ช่วยให้ผู้เรียกใช้สามารถขอไทล์พิกเซลแบบสุ่มจากรูปภาพ โดยระบุย่านและการวางผังแผนที่ได้ (ไม่บังคับ) ระบบจะเข้ารหัสข้อมูลที่ปกปิดหรือขาดหายไปเป็น 0
คำขอมีขีดจำกัดอยู่ที่ 48 MB สำหรับข้อมูลที่ไม่มีการบีบอัดต่อคำขอ ซึ่งคำนวณจากผลคูณของขนาดคำขอเป็นพิกเซล จำนวนแถบรูปภาพที่ขอ และจำนวนไบต์ต่อพิกเซลสำหรับแต่ละแถบ นอกจากนี้ คำขอยังจำกัดให้มีความละเอียดไม่เกิน 32,000 พิกเซลในด้านใดด้านหนึ่งและไม่เกิน 1,024 ย่านความถี่ คำขอที่เกินขีดจำกัดเหล่านี้จะส่งผลให้เกิดรหัสข้อผิดพลาด 400 (BAD_REQUEST)
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีข้อมูลพิกเซลที่ขอในการเข้ารหัสที่ระบุในช่อง fileFormat
ของคำขอ
คำขอ HTTP
POST https://earthengine.googleapis.com/v1alpha/{name=projects/*/assets/**}:getPixels
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
name |
string
ต้องระบุ ชื่อชิ้นงานรูปภาพที่จะดึงข้อมูลพิกเซล name อยู่ในรูปแบบ "projects/*/assets/**" (เช่น "projects/earthengine-legacy/assets/users/[USER]/[ASSET]"). ชิ้นงานทั้งหมดที่ผู้ใช้เป็นเจ้าของจะอยู่ในโปรเจ็กต์ "earthengine-legacy" (เช่น "projects/earthengine-legacy/assets/users/foo/bar"). ชิ้นงานอื่นๆ ทั้งหมดจะอยู่ภายใต้โปรเจ็กต์ "earthengine-public" (เช่น "projects/earthengine-public/assets/LANDSAT").
การให้สิทธิ์ต้องใช้สิทธิ์ IAM ต่อไปนี้ในทรัพยากร name ที่ระบุ
|
เนื้อหาของคำขอ
เนื้อความของคำขอมีข้อมูลซึ่งมีโครงสร้างดังต่อไปนี้
ช่อง |
fileFormat |
enum (ImageFileFormat )
รูปแบบไฟล์เอาต์พุตที่จะแสดงค่าพิกเซล
|
grid |
object (PixelGrid )
พารามิเตอร์ที่อธิบายตารางพิกเซลที่จะดึงข้อมูล ค่าเริ่มต้นคือตารางพิกเซลของข้อมูล
|
region |
object (Struct format)
ภูมิภาคของข้อมูลที่จะแสดง (หากมี) ซึ่งระบุเป็นออบเจ็กต์เรขาคณิต GeoJSON (ดู RFC 7946) เนื่องจากรูปภาพที่แสดงผลจะเป็นสี่เหลี่ยมผืนผ้าเสมอ ระบบจะใช้กล่องขอบเขตของรูปทรงเรขาคณิตที่ระบุในระบบพิกัดเอาต์พุต หากระบุ grid.dimensions ด้วย ระบบจะปรับขนาดตารางกริดเป็นขนาดที่ขอในขั้นตอนสุดท้าย
|
bandIds[] |
string
(หากมี) ระบุชุดแถบที่ต้องการใช้รับพิกเซล แถบจะระบุด้วยรหัสตามที่ระบุไว้ในช่อง id ของโปรโตคอล ImageBand
|
visualizationOptions |
object (VisualizationOptions )
ชุดตัวเลือกการแสดงภาพ (หากมี) เพื่อใช้สร้างการแสดงภาพ RGB 8 บิตของข้อมูลแทนการแสดงผลข้อมูลดิบ
|
workloadTag |
string
แท็กที่ผู้ใช้ระบุเพื่อติดตามการคํานวณนี้
|
เนื้อหาการตอบกลับ
หากดำเนินการสำเร็จ การตอบกลับจะเป็นคำตอบ HTTP ทั่วไปซึ่งรูปแบบจะกำหนดโดยเมธอด
ขอบเขตการให้สิทธิ์
ต้องใช้ขอบเขต 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 Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 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)."]]