前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Google Earth Engine(GEE)——显示和下载影像出现的问题

Google Earth Engine(GEE)——显示和下载影像出现的问题

作者头像
此星光明
发布2024-02-02 13:49:44
2660
发布2024-02-02 13:49:44
举报

当我们下载或者展示影像的时候会出现错误,本文主要解决两个问题,第一个就是解决影像展示的问题,展示如果不能正常显示影像的RGB影像,一般情况下主要出现的问题就在于最大值和最小值的设定,如果你不知道该如何设置,就直接去掉min和max的设置。这样也能正常显示,

Map.addLayer(eeObject, visParamsnameshownopacity)

Adds a given EE object to the map as a layer.

Returns the new map layer.

Arguments:

eeObject (Collection|Feature|Image|RawMapId):

The object to add to the map.

visParams (FeatureVisualizationParameters|ImageVisualizationParameters, optional):

The visualization parameters. For Images and ImageCollection, see ee.data.getMapId for valid parameters. For Features and FeatureCollections, the only supported key is "color", as a CSS 3.0 color string or a hex string in "RRGGBB" format. Ignored when eeObject is a map ID.

name (String, optional):

The name of the layer. Defaults to "Layer N".

shown (Boolean, optional):

A flag indicating whether the layer should be on by default.

opacity (Number, optional):

The layer's opacity represented as a number between 0 and 1. Defaults to 1.

Returns: ui.Map.Layer

原始代码:

代码语言:javascript
复制
var roi = 
    /* color: #d63000 */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[30.335363045782245, -22.81645461186883],
          [30.335363045782245, -23.114862567618875],
          [30.74597705945412, -23.114862567618875],
          [30.74597705945412, -22.81645461186883]]], null, false);

// Exporting Lansat 8 images

// Load Landsat 8 
var image= ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")
.filterDate("2017-01-01", "2017-12-31")
.filterBounds(roi)
.sort("CLOUD_COVER")
.first();

var vispaaramsTrue = {bands: ["SR_B4", "SR_B3", "SR_B2"], min: 0, max: 3000, gamma:1.4};
Map.addLayer(image.clip(roi), vispaaramsTrue, "Landsat 2017");
Map.centerObject(roi, 10);

// Export to drive
Export.image.toDrive({
image: image,
description: "Landsat2017Thohoyandou",
scale: 30,
region: roi,
maxPixels: 1e13
});

修改后的代码:

代码语言:javascript
复制
// Exporting Lansat 8 images

// Load Landsat 8 
var image= ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")
.filterDate("2017-01-01", "2017-12-31")
.filterBounds(roi)
.sort("CLOUD_COVER")
.first();

print(image)

var vispaaramsTrue = {bands: ["SR_B4", "SR_B3", "SR_B2"], min: 5000, max: 15000};
Map.addLayer(image.clip(roi), vispaaramsTrue, "Landsat 2017");
Map.centerObject(roi, 10);

// Export to drive
Export.image.toDrive({
image: image,
description: "Landsat2017Thohoyandou",
scale: 30,
region: roi,
maxPixels: 1e13
});

这里值得注意的是我们在下载影像的时候,我们必须得完成影像的的mosaic而不是使用.first()因为你下载first,你只能下载第一景影像而不是所有指定时间范围内的影像数据的聚合类型。否则下来的就直接是黑色的,大家可以去尝试一下

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-02-01,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Arguments:
  • Returns: ui.Map.Layer
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档