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


    当我们下载或者展示影像的时候会出现错误,本文主要解决两个问题,第一个就是解决影像展示的问题,展示如果不能正常显示影像的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

    原始代码:

    1. var roi =
    2. /* color: #d63000 */
    3. /* displayProperties: [
    4. {
    5. "type": "rectangle"
    6. }
    7. ] */
    8. ee.Geometry.Polygon(
    9. [[[30.335363045782245, -22.81645461186883],
    10. [30.335363045782245, -23.114862567618875],
    11. [30.74597705945412, -23.114862567618875],
    12. [30.74597705945412, -22.81645461186883]]], null, false);
    13. // Exporting Lansat 8 images
    14. // Load Landsat 8
    15. var image= ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")
    16. .filterDate("2017-01-01", "2017-12-31")
    17. .filterBounds(roi)
    18. .sort("CLOUD_COVER")
    19. .first();
    20. var vispaaramsTrue = {bands: ["SR_B4", "SR_B3", "SR_B2"], min: 0, max: 3000, gamma:1.4};
    21. Map.addLayer(image.clip(roi), vispaaramsTrue, "Landsat 2017");
    22. Map.centerObject(roi, 10);
    23. // Export to drive
    24. Export.image.toDrive({
    25. image: image,
    26. description: "Landsat2017Thohoyandou",
    27. scale: 30,
    28. region: roi,
    29. maxPixels: 1e13
    30. });

     

    修改后的代码:

    1. // Exporting Lansat 8 images
    2. // Load Landsat 8
    3. var image= ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")
    4. .filterDate("2017-01-01", "2017-12-31")
    5. .filterBounds(roi)
    6. .sort("CLOUD_COVER")
    7. .first();
    8. print(image)
    9. var vispaaramsTrue = {bands: ["SR_B4", "SR_B3", "SR_B2"], min: 5000, max: 15000};
    10. Map.addLayer(image.clip(roi), vispaaramsTrue, "Landsat 2017");
    11. Map.centerObject(roi, 10);
    12. // Export to drive
    13. Export.image.toDrive({
    14. image: image,
    15. description: "Landsat2017Thohoyandou",
    16. scale: 30,
    17. region: roi,
    18. maxPixels: 1e13
    19. });

     

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

     

  • 相关阅读:
    探索C语言结构体:编程中的利器与艺术
    InnoDB 中不同SQL语句设置的锁
    OK3568 forlinx系统编译过程及问题汇总
    【Netty 介绍】
    分享Java并发:线程间的通信
    C++面向对象(一)
    选择排序—直接选择排序和堆排序
    RNA修饰技术介绍|介孔二氧化硅纳米颗粒(MSN)搭载的微小RNA-24(miR-24)纳米载体复合物
    顶顶通呼叫中心中间件-添加自定义变量到CDR方法(mod_cti基于FreeSWITCH)
    【PyTorch深度学习项目实战100例】—— 基于PaddleOCR识别火车票信息 | 第65例
  • 原文地址:https://blog.csdn.net/qq_31988139/article/details/128028698