2

私の論文のためにLandsat画像をダウンロードする必要があります。私の問題はシンプルなようですが、私はJavaScriptについての手がかりがなく、ドキュメンテーションは十分に役に立たなかった。 地域と期間にコレクションをフィルタリングしました。すべてのイメージをドライブに別にエクスポートします。 コレクション例:Google Earth Engine画像コレクションのすべての画像をエクスポートする(Google Earth Engine API)

var surfaceReflectanceL5 = ee.ImageCollection('LANDSAT/LT5_SR'); 
var dateSR5=surfaceReflectanceL5.filterDate('1984-01-01', '1985-01-01'); 
var prSR5=dateSR5.filter(ee.Filter.eq('wrs_path', 182)) 
        .filter(ee.Filter.eq('wrs_row', 35)); 

単一の画像をエクスポートするためのコードは次のとおりです。

Export.image.toDrive({ 
    image: image1 //example, var image1='Landsat/....' 
    description: 'L51984_1', 
    scale: 30, 
}); 

にはどうすればすべての画像をエクスポートするコレクションを反復処理することができますか? map()関数の使用が答えのようです。

prSR5.map(Export.image.toDrive({ 
    image: image, 
    description: 'L51984', 
    scale: 30, 
})); 

質問は、正しい画像(すなわち、第1番目の画像、そして第二など、「thisImage()」のようなもの)と画像(すなわち'L51984_1''L51984_2'に一致するように記述に画像パラメータを設定する方法です。 ..)。

事前に感謝します。

+0

イメージをダウンロードするだけの場合は、[earthexplorer](https://earthexplorer.usgs.gov/)のようなもっと伝統的なソースを使うことをお勧めします。これは 'JavaScript'と潜在的にも速くて便利です。 – Val

+0

答えをありがとう。私は地球探検家からの注文を最初に試みましたが、注文は完了するまでに長い時間がかかります(バックログに200kの画像があるので、私は1ヶ月と仮定します...) – DiNik

答えて

3

私は同様の操作を実行するための関数を作成しました。私が作成したジーツールの束で提供されています:https://github.com/gee-community/gee_toolsここ

はコードです:私はそれをたくさん試してみましたが、私が作ったテストのカップルで働いていない

/* 
* Author: Rodrigo E. Principe 
* License: Apache 2.0 

PURPOSE: 
This function Exports all images from one Collection 
PARAMETERS: 
col = collection that contains the images (ImageCollection) (not optional) 
folder = the folder where images will go (str) (not optional) 
scale = the pixel's scale (int) (optional) (defaults to 1000) (for Landsat use 30) 
type = data type of the exported image (str) (option: "float", "byte", "int", "double") (optional) (defaults to "float") 
nimg = number of images of the collection (can be greater than the actual number) (int) (optional) (defaults to 500) 
maxPixels = max number of pixels to include in the image (int) (optional) (defults to 1e10) 
region = the region where images are on (Geometry.LinearRing or Geometry.Polygon) (optional) (defaults to the image footprint) 
Be careful with the region parameter. If the collection has images 
in different regions I suggest not to set that parameter 
EXAMPLE: 
ExportCol(myLandsatCol, "Landsat_imgs", 30) 
*/ 

var ExportCol = function(col, folder, scale, type, 
         nimg, maxPixels, region) { 
    type = type || "float"; 
    nimg = nimg || 500; 
    scale = scale || 1000; 
    maxPixels = maxPixels || 1e10; 

    var colList = col.toList(nimg); 
    var n = colList.size().getInfo(); 

    for (var i = 0; i < n; i++) { 
     var img = ee.Image(colList.get(i)); 
     var id = img.id().getInfo(); 
     region = region || img.geometry().bounds().getInfo()["coordinates"]; 

     var imgtype = {"float":img.toFloat(), 
        "byte":img.toByte(), 
        "int":img.toInt(), 
        "double":img.toDouble() 
        } 

     Export.image.toDrive({ 
     image:imgtype[type], 
     description: id, 
     folder: folder, 
     fileNamePrefix: id, 
     region: region, 
     scale: scale, 
     maxPixels: maxPixels}) 
    } 
    } 

、例:

var col = ee.ImageCollection("LEDAPS/LE7_L1T_SR").filterDate("2002-01-01","2002-01-03"); 
ExportCol(col, "test_Export_col", 30); 

ここにコメントすることができますが、githubに投稿することもできます。

関連する問題