ee.Image.getDownloadURL
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
קבלת כתובת URL להורדה של נתוני תמונה בחלקים קטנים בפורמט GeoTIFF או NumPy. הגודל המקסימלי של הבקשה הוא 32MB, והמימד המקסימלי של הרשת הוא 10,000.
כדי להשתמש בפורמטים של ויזואליזציה RGB, PNG ו-JPG, צריך להשתמש ב-getThumbURL.
הפונקציה מחזירה כתובת URL להורדה, או undefined אם צוינה קריאה חוזרת (callback).
שימוש | החזרות |
---|
Image.getDownloadURL(params, callback) | אובייקט|מחרוזת |
ארגומנט | סוג | פרטים |
---|
זה: image | תמונה | מופע התמונה. |
params | אובייקט | אובייקט שמכיל אפשרויות להורדה עם הערכים האפשריים הבאים:
name: שם בסיס לשימוש כשיוצרים שמות של קבצים. ההגדרה הזו רלוונטית רק אם הפורמט הוא ZIPPED_GEO_TIFF (ברירת מחדל) או אם filePerBand הוא true. ברירת המחדל היא מזהה התמונה (או 'הורדה' לתמונות מחושבות) אם הפורמט הוא ZIPPED_GEO_TIFF או אם filePerBand הוא true. אחרת, נוצר מחרוזת אקראית של תווים. שמות הלהקות מצורפים כשהערך של filePerBand הוא true. |
bands: תיאור של הרצועות להורדה. חייב להיות מערך של שמות רצועות או מערך של מילונים, שלכל אחד מהם יש את המפתחות הבאים (פרמטרים אופציונליים חלים רק אם filePerBand הוא true):
id: שם הלהקה, מחרוזת, חובה.
crs: מחרוזת CRS אופציונלית שמגדירה את הקרנת הפס.
-
crs_transform: מערך אופציונלי של 6 מספרים שמציין טרנספורמציה אפינית ממערכת ה-CRS שצוינה, בסדר שורות: [xScale, xShearing, xTranslation, yShearing, yScale, yTranslation]
-
dimensions: מערך אופציונלי של שני מספרים שלמים שמגדירים את הרוחב והגובה של האזור החתוך של הפס.
scale: מספר אופציונלי שמציין את קנה המידה במטרים של הפס. המערכת מתעלמת מהערך הזה אם מציינים את crs ואת crs_transform. |
crs: מחרוזת CRS שמוגדרת כברירת מחדל לשימוש בכל התדרים שלא צוינה להם מחרוזת כזו באופן מפורש. |
crs_transform: טרנספורמציה אפינית שמוגדרת כברירת מחדל לשימוש בכל הרצועות שלא צוינה להן טרנספורמציה, באותו פורמט כמו crs_transform של הרצועות. |
dimensions: מימדי ברירת המחדל לחיתוך תמונות לשימוש בכל הרצועות שלא צוינו בהן מימדים. |
scale: קנה מידה שמוגדר כברירת מחדל לשימוש בכל הטווחים שלא צוין להם קנה מידה. המערכת מתעלמת מהערך הזה אם צוינו הערכים crs ו-crs_transform .
|
region: פוליגון שמציין אזור להורדה. המערכת מתעלמת מהערך הזה אם מציינים את crs ואת crs_transform . |
filePerBand: האם ליצור קובץ GeoTIFF נפרד לכל פס (ערך בוליאני). ברירת המחדל היא True. אם הערך הוא False, נוצר קובץ GeoTIFF יחיד והמערכת מתעלמת מכל השינויים ברמת הפס. |
format: פורמט ההורדה. אחת מהאפשרויות:
- ZIPPED_GEO_TIFF (קובצי GeoTIFF עטופים בקובץ ZIP, ברירת מחדל)
- "GEO_TIFF" (קובץ GeoTIFF)
- NPY (פורמט בינארי של NumPy)
אם הערך הוא GEO_TIFF או NPY, המערכת תתעלם מהמאפיין filePerBand ומכל ההמרות ברמת הפס. טעינה של פלט 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 Environment.
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)
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[],["`Image.getDownloadURL` retrieves download URLs for image data in GeoTIFF or NumPy formats, with a 32 MB maximum size and 10,000 grid dimension limit. Parameters include specifying `name`, `bands`, `crs`, `crs_transform`, `dimensions`, `scale`, `region`, and `filePerBand`, and `format`. Formats can be ZIPPED_GEO_TIFF, GEO_TIFF, or NPY. The `getThumbURL` method is recommended for RGB formats. The method returns a download URL or is undefined if a callback is provided.\n"],null,[]]