ee.Image.getDownloadURL

GeoTIFF या NumPy फ़ॉर्मैट में इमेज डेटा के छोटे-छोटे हिस्सों के लिए, डाउनलोड करने का यूआरएल पाएं. अनुरोध का साइज़ ज़्यादा से ज़्यादा 32 एमबी और ग्रिड डाइमेंशन ज़्यादा से ज़्यादा 10, 000 होना चाहिए.

आरजीबी विज़ुअलाइज़ेशन फ़ॉर्मैट PNG और JPG के लिए, getThumbURL का इस्तेमाल करें.

यह फ़ंक्शन, डाउनलोड करने का यूआरएल दिखाता है. अगर कॉलबैक तय किया गया था, तो यह फ़ंक्शन undefined दिखाता है.

इस्तेमालरिटर्न
Image.getDownloadURL(params, callback)Object|String
आर्ग्यूमेंटटाइपविवरण
यह: imageइमेजImage इंस्टेंस.
paramsऑब्जेक्टयह एक ऐसा ऑब्जेक्ट होता है जिसमें डाउनलोड करने के विकल्प होते हैं. इसकी ये वैल्यू हो सकती हैं:
name: फ़ाइल के नाम बनाते समय इस्तेमाल किया जाने वाला आधार नाम. यह सिर्फ़ तब लागू होता है, जब फ़ॉर्मैट "ZIPPED_GEO_TIFF" (डिफ़ॉल्ट) हो या filePerBand सही पर सेट हो. जब फ़ॉर्मैट "ZIPPED_GEO_TIFF" होता है या 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 बनाया जाता है और बैंड-लेवल के सभी ट्रांसफ़ॉर्मेशन को अनदेखा कर दिया जाता है.
format: डाउनलोड करने का फ़ॉर्मैट. इनमें से कोई एक:
  • "ZIPPED_GEO_TIFF" (GeoTIFF फ़ाइलों को ZIP फ़ाइल में रैप किया जाता है. यह डिफ़ॉल्ट फ़ॉर्मैट है)
  • "GEO_TIFF" (GeoTIFF फ़ाइल)
  • "NPY" (NumPy बाइनरी फ़ॉर्मैट)
अगर "GEO_TIFF" या "NPY" फ़ाइल फ़ॉर्मैट चुना जाता है, तो फ़ाइलपरबैंड और बैंड-लेवल के सभी ट्रांसफ़ॉर्मेशन को अनदेखा कर दिया जाएगा. NumPy के आउटपुट को लोड करने से, स्ट्रक्चर्ड अरे मिलता है.
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);

print('Single-band GeoTIFF files wrapped in a zip file',
  img.getDownloadURL({
    name: 'single_band',
    bands: ['B3', 'B8', 'B11'],
    region: region
  }));

print('Multi-band GeoTIFF file wrapped in a zip file',
  img.getDownloadURL({
    name: 'multi_band',
    bands: ['B3', 'B8', 'B11'],
    region: region,
    scale: 20,
    filePerBand: false
  }));

print('Band-specific transformations',
  img.getDownloadURL({
    name: 'custom_single_band',
    bands: [
      {id: 'B3', scale: 10},
      {id: 'B8', scale: 10},
      {id: 'B11', scale: 20}
    ],
    region: region
  }));

print('Multi-band GeoTIFF file',
  img.getDownloadURL({
    bands: ['B3', 'B8', 'B11'],
    region: region,
    scale: 20,
    format: 'GEO_TIFF'
  }));

Python सेटअप करना

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

import ee
import geemap.core as geemap

Colab (Python)

"""Demonstrates the ee.Image.getDownloadURL 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
url = img.getDownloadUrl({
    'bands': ['B3', 'B8', 'B11'],
    'region': region,
    'scale': 20,
    'format': 'NPY'
})
response = requests.get(url)
data = numpy.load(io.BytesIO(response.content))
print(data)
print(data.dtype)

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

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

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

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