ee.data.getDownloadId

डाउनलोड आईडी पाएं.

यह फ़ंक्शन, डाउनलोड आईडी और टोकन दिखाता है. अगर कॉलबैक तय किया गया है, तो यह फ़ंक्शन शून्य दिखाता है.

इस्तेमालरिटर्न
ee.data.getDownloadId(params, callback)DownloadId
आर्ग्यूमेंटटाइपविवरण
paramsऑब्जेक्टयह एक ऐसा ऑब्जेक्ट होता है जिसमें डाउनलोड करने के विकल्प होते हैं. इसकी ये वैल्यू हो सकती हैं:
name: फ़ाइल के नाम बनाते समय इस्तेमाल किया जाने वाला आधार नाम. यह सिर्फ़ तब लागू होता है, जब फ़ॉर्मैट "ZIPPED_GEO_TIFF" (डिफ़ॉल्ट), "ZIPPED_GEO_TIFF_PER_BAND" या filePerBand सही पर सेट हो. अगर फ़ॉर्मैट "ZIPPED_GEO_TIFF", "ZIPPED_GEO_TIFF_PER_BAND" है या filePerBand की वैल्यू सही है, तो डिफ़ॉल्ट रूप से इमेज आईडी (या कंप्यूट की गई इमेज के लिए "download") का इस्तेमाल किया जाता है. ऐसा न होने पर, वर्णों की कोई रैंडम स्ट्रिंग जनरेट की जाती है. filePerBand के सही होने पर, बैंड के नाम जोड़े जाते हैं.
bands: डाउनलोड किए जाने वाले बैंड के बारे में जानकारी. यह बैंड के नामों की एक कैटगरी या डिक्शनरी की एक कैटगरी होनी चाहिए. हर डिक्शनरी में ये कुंजियां होनी चाहिए (वैकल्पिक पैरामीटर सिर्फ़ तब लागू होते हैं, जब filePerBand सही हो):
  • id: बैंड का नाम, स्ट्रिंग, ज़रूरी है.
  • crs: बैंड प्रोजेक्शन को तय करने वाली एक वैकल्पिक सीआरएस स्ट्रिंग.
  • crs_transform: छह संख्याओं का एक वैकल्पिक ऐरे, जो पंक्ति के हिसाब से क्रम में, तय किए गए सीआरएस से ऐफ़ाइन ट्रांसफ़ॉर्म तय करता है: [xScale, xShearing, xTranslation, yShearing, yScale, yTranslation]
  • dimensions: दो पूर्णांकों की एक वैकल्पिक सरणी, जो बैंड की चौड़ाई और ऊंचाई को तय करती है.
  • scale: एक वैकल्पिक संख्या, जो बैंड के स्केल को मीटर में दिखाती है. अगर crs और crs_transform की वैल्यू सेट की जाती है, तो इसे अनदेखा कर दिया जाता है.
crs: एक डिफ़ॉल्ट सीआरएस स्ट्रिंग, जिसका इस्तेमाल उन बैंड के लिए किया जा सकता है जिनके लिए कोई स्ट्रिंग साफ़ तौर पर नहीं बताई गई है.
crs_transform: एक डिफ़ॉल्ट अफ़ाइन ट्रांसफ़ॉर्म, जिसका इस्तेमाल उन बैंड के लिए किया जाता है जो किसी बैंड के crs_transform के फ़ॉर्मैट में ट्रांसफ़ॉर्म के बारे में नहीं बताते हैं.
dimensions: डिफ़ॉल्ट इमेज क्रॉपिंग डाइमेंशन, जिनका इस्तेमाल उन बैंड के लिए किया जाता है जो उन्हें तय नहीं करते.
scale: एक डिफ़ॉल्ट स्केल, जिसका इस्तेमाल उन बैंड के लिए किया जाता है जिनमें कोई स्केल तय नहीं किया गया है. अगर crs और crs_transform तय किए गए हैं, तो इसे अनदेखा कर दिया जाता है.
region: डाउनलोड करने के लिए किसी क्षेत्र को तय करने वाला पॉलीगॉन. अगर crs और crs_transform की वैल्यू तय की जाती है, तो इसे अनदेखा कर दिया जाता है.
filePerBand: हर बैंड के लिए अलग GeoTIFF बनाना है या नहीं (बूलियन). डिफ़ॉल्ट रूप से, यह वैल्यू 'सही' पर सेट होती है. गलत होने पर, एक GeoTIFF बनाया जाता है और बैंड-लेवल के सभी ट्रांसफ़ॉर्मेशन को अनदेखा कर दिया जाता है. ध्यान दें कि अगर फ़ॉर्मैट "ZIPPED_GEO_TIFF" या "ZIPPED_GEO_TIFF_PER_BAND" है, तो इसे अनदेखा कर दिया जाता है.
format: डाउनलोड करने का फ़ॉर्मैट. इनमें से कोई एक:
  • "ZIPPED_GEO_TIFF" (GeoTIFF फ़ाइल को ZIP फ़ाइल में रैप किया गया है, डिफ़ॉल्ट)
  • "ZIPPED_GEO_TIFF_PER_BAND" (एक zip फ़ाइल में रैप की गई कई GeoTIFF फ़ाइलें)
  • "NPY" (NumPy बाइनरी फ़ॉर्मैट)
अगर "GEO_TIFF" या "NPY" फ़ाइल फ़ॉर्मैट चुना जाता है, तो फ़ाइलपरबैंड और बैंड-लेवल के सभी ट्रांसफ़ॉर्मेशन को अनदेखा कर दिया जाएगा. NumPy के आउटपुट को लोड करने से, स्ट्रक्चर्ड अरे मिलता है.
id: deprecated, use image parameter.
callbackफ़ंक्शन, ज़रूरी नहीं हैवैकल्पिक कॉलबैक. अगर यह पैरामीटर नहीं दिया जाता है, तो कॉल सिंक्रोनस तरीके से किया जाता है.

उदाहरण

कोड एडिटर (JavaScript)

// A Sentinel-2 surface reflectance image.
var img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG');

// A small region within the image.
var region = ee.Geometry.BBox(-122.0859, 37.0436, -122.0626, 37.0586);

var downloadId = ee.data.getDownloadId({
    image: img,
    name: 'single_band',
    bands: ['B3', 'B8', 'B11'],
    region: region
});
print('Single-band GeoTIFF files wrapped in a zip file',
      ee.data.makeDownloadUrl(downloadId));

var downloadId = ee.data.getDownloadId({
  image: img,
  name: 'multi_band',
  bands: ['B3', 'B8', 'B11'],
  region: region,
  scale: 20,
  filePerBand: false
});
print('Multi-band GeoTIFF file wrapped in a zip file',
      ee.data.makeDownloadUrl(downloadId));

var downloadId = ee.data.getDownloadId({
  image: img,
  name: 'custom_single_band',
  bands: [
    {id: 'B3', scale: 10},
    {id: 'B8', scale: 10},
    {id: 'B11', scale: 20}
  ],
  region: region
});
print('Band-specific transformations',
      ee.data.makeDownloadUrl(downloadId));

var downloadId = ee.data.getDownloadId({
  image: img,
  bands: ['B3', 'B8', 'B11'],
  region: region,
  scale: 20,
  format: 'GEO_TIFF'
});
print('Multi-band GeoTIFF file',
      ee.data.makeDownloadUrl(downloadId));

Python सेटअप करना

Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के बारे में जानकारी पाने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

Colab (Python)

"""Demonstrates the ee.data.getDownloadId method."""

import io
import requests
import ee


ee.Authenticate()
ee.Initialize()

# A Sentinel-2 surface reflectance image.
img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG')

# A small region within the image.
region = ee.Geometry.BBox(-122.0859, 37.0436, -122.0626, 37.0586)

# Image chunk as a NumPy structured array.
import numpy
download_id = ee.data.getDownloadId({
    'image': img,
    'bands': ['B3', 'B8', 'B11'],
    'region': region,
    'scale': 20,
    'format': 'NPY'
})
response = requests.get(ee.data.makeDownloadUrl(download_id))
data = numpy.load(io.BytesIO(response.content))
print(data)
print(data.dtype)

# Single-band GeoTIFF files wrapped in a zip file.
download_id = ee.data.getDownloadId({
    'image': img,
    'name': 'single_band',
    'bands': ['B3', 'B8', 'B11'],
    'region': region
})
response = requests.get(ee.data.makeDownloadUrl(download_id))
with open('single_band.zip', 'wb') as fd:
  fd.write(response.content)

# Multi-band GeoTIFF file wrapped in a zip file.
download_id = ee.data.getDownloadId({
    'image': img,
    'name': 'multi_band',
    'bands': ['B3', 'B8', 'B11'],
    'region': region,
    'scale': 20,
    'filePerBand': False
})
response = requests.get(ee.data.makeDownloadUrl(download_id))
with open('multi_band.zip', 'wb') as fd:
  fd.write(response.content)

# Band-specific transformations.
download_id = ee.data.getDownloadId({
    'image': img,
    'name': 'custom_single_band',
    'bands': [
        {'id': 'B3', 'scale': 10},
        {'id': 'B8', 'scale': 10},
        {'id': 'B11', 'scale': 20}
    ],
    'region': region
})
response = requests.get(ee.data.makeDownloadUrl(download_id))
with open('custom_single_band.zip', 'wb') as fd:
  fd.write(response.content)

# Multi-band GeoTIFF file.
download_id = ee.data.getDownloadId({
    'image': img,
    'bands': ['B3', 'B8', 'B11'],
    'region': region,
    'scale': 20,
    'format': 'GEO_TIFF'
})
response = requests.get(ee.data.makeDownloadUrl(download_id))
with open('multi_band.tif', 'wb') as fd:
  fd.write(response.content)