Method: projects.assets.getPixels
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
किसी इमेज ऐसेट से पिक्सल फ़ेच करता है. इस कस्टम तरीके की मदद से, कॉलर किसी इमेज से पिक्सल की अपनी पसंद की टाइल का अनुरोध कर सकता है. इसके लिए, बैंड और मैप प्रोजेक्शन की जानकारी देना ज़रूरी नहीं है. मास्क किया गया या मौजूद न होने वाला डेटा, शून्य के तौर पर कोड में बदल दिया जाएगा.
हर अनुरोध के लिए, अनकंप्रेस किए गए डेटा की सीमा 48 एमबी है. इसे पिक्सल में अनुरोध के डाइमेंशन, अनुरोध की गई इमेज बैंड की संख्या, और हर बैंड के लिए हर पिक्सल की बाइट की संख्या के प्रॉडक्ट के तौर पर कैलकुलेट किया जाता है. अनुरोधों के लिए, किसी भी डाइमेंशन में ज़्यादा से ज़्यादा 32K पिक्सल और ज़्यादा से ज़्यादा 1024 बैंड की सीमा तय है. इन सीमाओं से ज़्यादा अनुरोध करने पर, गड़बड़ी का कोड 400 (BAD_REQUEST) दिखेगा.
अगर अनुरोध पूरा हो जाता है, तो जवाब के मुख्य हिस्से में अनुरोध किए गए पिक्सल डेटा को, अनुरोध के fileFormat
फ़ील्ड में बताए गए कोड में शामिल किया जाता है.
एचटीटीपी अनुरोध
POST https://earthengine.googleapis.com/v1alpha/{name=projects/*/assets/**}:getPixels
यूआरएल में 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").
अनुमति पाने के लिए, दिए गए संसाधन name पर IAM की यह अनुमति ज़रूरी है:
|
अनुरोध का मुख्य भाग
अनुरोध के मुख्य भाग में नीचे दिए गए स्ट्रक्चर वाला डेटा होता है:
JSON के काेड में दिखाना |
{
"fileFormat": enum (ImageFileFormat ),
"grid": {
object (PixelGrid )
},
"region": {
object
},
"bandIds": [
string
],
"visualizationOptions": {
object (VisualizationOptions )
},
"workloadTag": string
} |
फ़ील्ड |
fileFormat |
enum (ImageFileFormat )
आउटपुट फ़ाइल का फ़ॉर्मैट, जिसमें पिक्सल वैल्यू दिखानी हैं.
|
grid |
object (PixelGrid )
ऐसे पैरामीटर जिनसे उस पिक्सल ग्रिड के बारे में पता चलता है जिसमें डेटा फ़ेच करना है. यह डिफ़ॉल्ट रूप से, डेटा के नेटिव पिक्सल ग्रिड पर सेट होता है.
|
region |
object (Struct format)
अगर मौजूद है, तो डेटा का वह क्षेत्र जिसे दिखाना है. इसे GeoJSON ज्यामिति ऑब्जेक्ट के तौर पर दिखाया जाता है (RFC 7946 देखें). रिटर्न की गई इमेज हमेशा आयताकार होती है. इसलिए, आउटपुट कोऑर्डिनेट सिस्टम में दी गई ज्यामिति के बाउंडिंग बॉक्स का इस्तेमाल किया जाएगा. अगर grid.dimensions भी तय किया गया है, तो आखिर में ग्रिड को अनुरोध किए गए साइज़ में फिर से स्केल कर दिया जाएगा.
|
bandIds[] |
string
अगर मौजूद है, तो यह बैंड के किसी खास सेट के बारे में बताता है, ताकि पिक्सल हासिल किए जा सकें. बैंड की पहचान आईडी से की जाती है, जैसा कि ImageBand प्रोटो के id फ़ील्ड से पता चलता है.
|
visualizationOptions |
object (VisualizationOptions )
अगर मौजूद है, तो विज़ुअलाइज़ेशन के विकल्पों का एक सेट, जो रॉ डेटा दिखाने के बजाय, डेटा का 8-बिट आरजीबी विज़ुअलाइज़ेशन दिखाने के लिए लागू किया जाता है.
|
workloadTag |
string
इस कैलकुलेशन को ट्रैक करने के लिए, उपयोगकर्ता का दिया गया टैग.
|
जवाब का मुख्य भाग
अगर अनुरोध पूरा हो जाता है, तो रिस्पॉन्स एक सामान्य एचटीटीपी रिस्पॉन्स होता है. इसका फ़ॉर्मैट, तरीके के हिसाब से तय होता है.
अनुमति के दायरे
इसके लिए, 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 देखें.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 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)."]]