GEE 下载错误:Error: Export too large: specified 378421176 pixels(max

举报
此星光明 发表于 2022/12/05 19:33:34 2022/12/05
【摘要】 ​问题:Error: Export too large: specified 378421176 pixels(max: 100000000).Specify higher maxPixels value ifyou intend to export a large area. (Error code: 3)From the following code, I want to export ...


问题:


Error: Export too large: specified 378421176 pixels(max: 100000000).Specify higher maxPixels value ifyou intend to export a large area. (Error code: 3)

From the following code, I want to export the River flow change in Bangladesh. However, I could not export the GeoTiff file. How can I fix it? I am sharing the code & shp file of Bangladesh Boundary.

从下面的代码中,我想导出孟加拉国的河流流量变化。但是,我无法导出GeoTiff文件。我该如何解决它?我正在分享孟加拉国边界的代码和shp文件。

https://code.earthengine.google.com/b1eec49a0805a265de9de0d5f5d0ca10

https://code.earthengine.google.com/f6fc6e14f44cde997a297299c0fd59f3

编辑

 下面的代码修改的,修改的主要目的就是为了让其没有共享的矢量文件不影响操作,我们这里利用在线的画图工具画一个几何,代替原有的孟加拉国矢量边界,用于提取具体的河流信息。

函数:

Export.image.toDrive(image, descriptionfolderfileNamePrefixdimensionsregionscalecrscrsTransformmaxPixelsshardSizefileDimensionsskipEmptyTilesfileFormatformatOptions)

Creates a batch task to export an Image as a raster to Drive. Tasks can be started from the Tasks tab. "crsTransform", "scale", and "dimensions" are mutually exclusive.

Arguments:

image (Image):

The image to export.

description (String, optional):

A human-readable name of the task. May contain letters, numbers, -, _ (no spaces). Defaults to "myExportImageTask".

folder (String, optional):

The Google Drive Folder that the export will reside in. Note: (a) if the folder name exists at any level, the output is written to it, (b) if duplicate folder names exist, output is written to the most recently modified folder, (c) if the folder name does not exist, a new folder will be created at the root, and (d) folder names with separators (e.g. 'path/to/file') are interpreted as literal strings, not system paths. Defaults to Drive root.

fileNamePrefix (String, optional):

The filename prefix. May contain letters, numbers, -, _ (no spaces). Defaults to the description.

dimensions (Number|String, optional):

The dimensions to use for the exported image. Takes either a single positive integer as the maximum dimension or "WIDTHxHEIGHT" where WIDTH and HEIGHT are each positive integers.

region (Geometry.LinearRing|Geometry.Polygon|String, optional):

A LinearRing, Polygon, or coordinates representing region to export. These may be specified as the Geometry objects or coordinates serialized as a string.

scale (Number, optional):

Resolution in meters per pixel. Defaults to 1000.

crs (String, optional):

CRS to use for the exported image.

crsTransform (List<Number>|String, optional):

Affine transform to use for the exported image. Requires "crs" to be defined.

maxPixels (Number, optional):

Restrict the number of pixels in the export. By default, you will see an error if the export exceeds 1e8 pixels. Setting this value explicitly allows one to raise or lower this limit.

shardSize (Number, optional):

Size in pixels of the tiles in which this image will be computed. Defaults to 256.

fileDimensions (List<Number>|Number, optional):

The dimensions in pixels of each image file, if the image is too large to fit in a single file. May specify a single number to indicate a square shape, or an array of two dimensions to indicate (width,height). Note that the image will still be clipped to the overall image dimensions. Must be a multiple of shardSize.

skipEmptyTiles (Boolean, optional):

If true, skip writing empty (i.e. fully-masked) image tiles. Defaults to false.

fileFormat (String, optional):

The string file format to which the image is exported. Currently only 'GeoTIFF' and 'TFRecord' are supported, defaults to 'GeoTIFF'.

formatOptions (ImageExportFormatConfig, optional):

A dictionary of string keys to format specific options.


代码:

var imageVisParam = {"opacity":1,"bands":["B3_median"],"palette":["00009b"]},
    imageVisParam2 = {"opacity":1,"bands":["B3_median"],"palette":["880791"]},
    BND = ee.FeatureCollection("users/afrozmou12/BGD_adm0"),
    AOI = 
    /* color: #d63000 */
    /* shown: false */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[87.3790736264902, 26.657937057011218],
          [87.3790736264902, 21.42307673997418],
          [93.2238001889902, 21.42307673997418],
          [93.2238001889902, 26.657937057011218]]], null, false);

// Author: Palash Basak
// https://www.linkedin.com/in/palashbasak/

// 16 June 2022

// Link to this script: 

Map.centerObject(AOI, 10);

// Landsat 5
// From 1992 to 2012

// No Image was found for year 2002 and 2012
// Ignore the error messages

for (var i = 1987; i <= 2012; ++i) {
  // Load an image collection, filtered so it's not too much data.
  var collection = ee.ImageCollection('LANDSAT/LT05/C01/T1_TOA')
    .filterDate(i + '-01-01', i + '-12-31')
    .filterBounds(AOI);
  
  print(collection);
  // Compute the median in each band, each pixel.
  // Band names are B1_median, B2_median, etc.
  var median = collection.reduce(ee.Reducer.median()).clip(AOI);
  
  var vis_param = {bands: ['B4_median', 'B5_median', 'B3_median'], gamma: 1.7};
  Map.addLayer(median, vis_param, i + ' Landsat 5 image', false );
  
  var GREEN = median.select('B2_median');
  var MIR = median.select('B5_median');
  var MNDWI = GREEN.subtract(MIR).divide(GREEN.add(MIR));
  Map.addLayer(MNDWI, {min: 0, max: 1}, i + ' MNDWI', false);
  
  var water = MNDWI.gt(0.1);
  Map.addLayer(water.updateMask(water), {palette: ['e03809']}, i + ' Water', true ).setOpacity(0.5);
  
  // Export to Google Drive
  Export.image.toDrive({
    image: water.updateMask(water),
    description: i + '_Water_Padma',
    folder: 'GoogleEarthEngine',
    scale: 30,
    region: AOI
  });
}

// var collection = ee.ImageCollection('LANDSAT/LT05/C01/T1_TOA')
//     .filterDate('1987-01-01', '2012-12-31')
//     .filterBounds(AOI);
// print(collection);
// Landsat 8
// 2013 onward
for (var i = 2013; i <= 2022; ++i) {
  var collection = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')
    .filterDate(i + '-01-01', i + '-12-31')
    .filterBounds(BND);
  
  print(collection);
  // Compute the median in each band, each pixel.
  // Band names are B1_median, B2_median, etc.
  var median = collection.reduce(ee.Reducer.median()).clip(BND);
  
  var vis_param = {bands: ['B5_median', 'B6_median', 'B4_median'], gamma: 1.7};
  Map.addLayer(median, vis_param, i + ' Landsat 8 image', false);
  
  var GREEN = median.select('B3_median');
  var MIR = median.select('B6_median');
  var MNDWI = GREEN.subtract(MIR).divide(GREEN.add(MIR));
  Map.addLayer(MNDWI, {min: 0, max: 1}, i + ' MNDWI', false);
  
  var water = MNDWI.gt(0.1);
  Map.addLayer(water.updateMask(water), {palette: ['346cfa']}, i + ' Water', true ).setOpacity(0.5);
  
  // Export to Google Drive
  Export.image.toDrive({
    image: water.updateMask(water),
    description: i + '_Water_Padma',
    folder: 'GoogleEarthEngine',
    scale: 30,
    region: BND
  });
}

 


 ​​​​​​​

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。