お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、Earth Engine へのアクセスを維持するために
非商用目的での利用資格を確認する必要があります。
ee.data.getDownloadId
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ダウンロード ID を取得します。
ダウンロード ID とトークンを返します。コールバックが指定されている場合は null を返します。
用途 | 戻り値 |
---|
ee.data.getDownloadId(params, callback) | DownloadId |
引数 | タイプ | 詳細 |
---|
params | オブジェクト | ダウンロード オプションを含むオブジェクト。次の値を使用できます。
name: ファイル名を構築するときに使用するベース名。形式が「ZIPPED_GEO_TIFF」(デフォルト)、「ZIPPED_GEO_TIFF_PER_BAND」、または filePerBand が true の場合にのみ適用されます。形式が「ZIPPED_GEO_TIFF」、「ZIPPED_GEO_TIFF_PER_BAND」、または filePerBand が true の場合は、デフォルトで画像 ID(計算された画像の場合は「download」)になります。それ以外の場合は、ランダムな文字列が生成されます。filePerBand が true の場合、バンド名が追加されます。 |
bands: ダウンロードするバンドの説明。帯域名または辞書の配列である必要があります。各辞書には次のキーが含まれます(省略可能なパラメータは filePerBand が true の場合にのみ適用されます)。
id: バンドの名前(文字列、必須)。 crs: : バンド投影を定義するオプションの CRS 文字列。
crs_transform: : 指定された CRS からのアフィン変換を指定する 6 個の数値の配列(行優先順)。[xScale, xShearing, xTranslation, yShearing, yScale, yTranslation]
dimensions: : バンドが切り抜かれる幅と高さを定義する 2 つの整数の省略可能な配列。
scale: : バンドのスケールをメートル単位で指定する省略可能な数値。crs と crs_transform が指定されている場合は無視されます。 |
crs: 明示的に指定されていない帯域で使用するデフォルトの CRS 文字列。 |
crs_transform: : バンドの crs_transform と同じ形式で、アフィン変換を指定していないバンドに使用するデフォルトのアフィン変換。 |
dimensions: デフォルトの画像切り抜きサイズ。指定されていない帯域で使用されます。 |
scale: : スケールを指定しない帯域で使用するデフォルトのスケール。crs と crs_transform が指定されている場合は無視されます。 |
ダウンロードする領域を指定するポリゴン。crs と crs_transform が指定されている場合は無視されます。 region: |
filePerBand: : バンドごとに個別の GeoTIFF を生成するかどうか(ブール値)。デフォルトは true です。false の場合、単一の GeoTIFF が生成され、すべてのバンドレベルの変換は無視されます。形式が「ZIPPED_GEO_TIFF」または「ZIPPED_GEO_TIFF_PER_BAND」の場合、この値は無視されます。 |
format: ダウンロード形式。次のいずれか:
- 「ZIPPED_GEO_TIFF」(GeoTIFF ファイルを zip ファイルでラップ、デフォルト)
- 「ZIPPED_GEO_TIFF_PER_BAND」(複数の GeoTIFF ファイルが zip ファイルにラップされている)
- 「NPY」(NumPy バイナリ形式)
「GEO_TIFF」または「NPY」の場合、filePerBand とすべてのバンドレベルの変換は無視されます。NumPy 出力を読み込むと、構造化配列が生成されます。 |
id: は非推奨になりました。イメージ パラメータを使用してください。 |
|
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)
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[null,null,["最終更新日 2025-07-26 UTC。"],[[["\u003cp\u003e\u003ccode\u003eee.data.getDownloadId\u003c/code\u003e generates a unique ID and token for downloading Earth Engine data, essential for initiating downloads.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts parameters like image, bands, region, and format to customize the download request to user specifications.\u003c/p\u003e\n"],["\u003cp\u003eUsers can specify download formats including zipped GeoTIFFs (single or multi-band), NumPy arrays, and uncompressed GeoTIFFs.\u003c/p\u003e\n"],["\u003cp\u003eThe function provides flexibility by allowing band-specific transformations such as scale and projection settings for individual bands.\u003c/p\u003e\n"],["\u003cp\u003eDownload links are created using the generated download ID with \u003ccode\u003eee.data.makeDownloadUrl\u003c/code\u003e for accessing the requested data.\u003c/p\u003e\n"]]],["The `ee.data.getDownloadId` function generates a download ID and token for Earth Engine data. Key actions include specifying download parameters like image, bands, region, scale, and format in a `params` object. This can include band-specific transformations. The function returns a `DownloadId`, or null if a callback is specified, allowing for synchronous or asynchronous calls. The output can be configured to be a single or multiple GeoTIFF files wrapped in a zip or in NPY format.\n"],null,[]]