ee.Image.getDownloadURL
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
รับ URL การดาวน์โหลดสำหรับข้อมูลรูปภาพขนาดเล็กในรูปแบบ GeoTIFF หรือ NumPy ขนาดคำขอสูงสุดคือ 32 MB และมิติข้อมูลตารางกริดสูงสุดคือ 10000
ใช้ getThumbURL สำหรับรูปแบบการแสดงภาพ RGB ในรูปแบบ PNG และ JPG
การส่งคืนจะแสดงผล URL การดาวน์โหลด หรือไม่แสดงผลหากมีการระบุการเรียกกลับ
การใช้งาน | การคืนสินค้า |
---|
Image.getDownloadURL(params, callback) | Object|String |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ image | รูปภาพ | อินสแตนซ์รูปภาพ |
params | วัตถุ | ออบเจ็กต์ที่มีตัวเลือกการดาวน์โหลดพร้อมค่าที่เป็นไปได้ต่อไปนี้
name: ชื่อฐานที่จะใช้เมื่อสร้างชื่อไฟล์ มีผลเฉพาะเมื่อรูปแบบเป็น "ZIPPED_GEO_TIFF" (ค่าเริ่มต้น) หรือ filePerBand เป็นจริง ค่าเริ่มต้นคือรหัสรูปภาพ (หรือ "ดาวน์โหลด" สำหรับรูปภาพที่คำนวณแล้ว) เมื่อรูปแบบคือ "ZIPPED_GEO_TIFF" หรือ filePerBand เป็นจริง ไม่เช่นนั้นระบบจะสร้างสตริงอักขระแบบสุ่ม ระบบจะต่อท้ายชื่อวงดนตรีเมื่อ filePerBand เป็นจริง |
bands: คำอธิบายของแถบที่จะดาวน์โหลด ต้องเป็นอาร์เรย์ของชื่อแถบหรืออาร์เรย์ของพจนานุกรม โดยแต่ละรายการมีคีย์ต่อไปนี้ (พารามิเตอร์ที่ไม่บังคับจะใช้ได้ก็ต่อเมื่อ filePerBand เป็นจริงเท่านั้น)
id: ชื่อวงดนตรี ซึ่งเป็นสตริง (ต้องระบุ)
crs: สตริง CRS ที่ไม่บังคับซึ่งกำหนดการฉายแถบ
crs_transform: อาร์เรย์ตัวเลข 6 ตัวที่ไม่บังคับซึ่งระบุการแปลงแบบแอฟฟินจาก CRS ที่ระบุในลำดับแถวหลัก: [xScale, xShearing, xTranslation, yShearing, yScale, yTranslation]
dimensions: อาร์เรย์ของจำนวนเต็ม 2 จำนวนที่ไม่บังคับซึ่งกำหนดความกว้างและความสูงที่จะครอบตัดแถบ
scale: ตัวเลขที่ไม่บังคับซึ่งระบุสเกลในหน่วยเมตรของแถบ โดยระบบจะละเว้นหากมีการระบุ crs และ crs_transform |
crs: สตริง CRS เริ่มต้นที่จะใช้กับแถบความถี่ที่ไม่ได้ระบุไว้อย่างชัดเจน |
crs_transform: การแปลงแบบแอฟฟินเริ่มต้นที่จะใช้กับแถบใดก็ตามที่ไม่ได้ระบุแถบที่มีรูปแบบเดียวกันกับ
crs_transform ของแถบ |
dimensions: ขนาดการครอบตัดรูปภาพเริ่มต้นที่จะใช้กับแถบใดก็ตามที่ไม่ได้ระบุขนาด |
scale: สเกลเริ่มต้นที่จะใช้กับแถบความถี่ที่ไม่ได้ระบุไว้ โดยจะถูกละเว้นหากมีการระบุ crs และ
crs_transform |
region: รูปหลายเหลี่ยมที่ระบุภูมิภาคที่จะดาวน์โหลด ระบบจะไม่สนใจหากระบุ crs และ crs_transform |
filePerBand: จะสร้าง GeoTIFF แยกกันต่อแบนด์หรือไม่ (บูลีน) ค่าเริ่มต้นคือ True หากเป็นเท็จ ระบบจะสร้าง 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
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)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 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,[]]