美文网首页GEE案例
GEE组合图像,边界裁切

GEE组合图像,边界裁切

作者: 赤豆冰棍 | 来源:发表于2019-01-05 13:27 被阅读0次

    标记特定像素

    主要功能

    获取一特定时间段内所有数据的集合,计算所有数据的中值,筛选矢量数据,完成数据裁剪

    代码

    // Composite an image collection and clip it to a boundary.
    
    // Load Landsat 7 raw imagery and filter it to April-July 2000.
    var collection = ee.ImageCollection('LANDSAT/LE07/C01/T1')
        .filterDate('2000-04-01', '2000-07-01');
    
    // Reduce the collection by taking the median.
    var median = collection.median();
    
    // Load a table of state boundaries and filter.
    var fc = ee.FeatureCollection('TIGER/2016/States')
        .filter(ee.Filter.or(
            ee.Filter.eq('NAME', 'Nevada'),
            ee.Filter.eq('NAME', 'Arizona')));
    
    // Clip to the output image to the Nevada and Arizona state boundaries.
    var clipped = median.clipToCollection(fc);
    
    // Display the result.
    Map.setCenter(-110, 40, 5);
    var visParams = {bands: ['B3', 'B2', 'B1'], gain: [1.4, 1.4, 1.1]};
    Map.addLayer(clipped, visParams, 'clipped composite');
    

    步骤分析

    1. 生成数据集对象,使用数据名称来加载特定数据
    2. 计算数据集中值
    3. 创建特征数据集对象,使用数据名称加载数据
    4. 使用特征名称来筛选数据集,获取矢量边界
    5. 裁剪数据集
    6. 设置地图中心,缩放等级
    7. 设置图层显示参数
    8. 加载图层,重命名图层

    主要方法

    1. ee.ImageCollection()
      ImageCollections can be constructed from the following arguments:
    • A string: assumed to be the name of a collection,
    • A list of images, or anything that can be used to construct an image.
    • A single image.
    • A computed object - reinterpreted as a collection.
      Arguments:
      args (ComputedObject|Image|List<Object>|String):
      The constructor arguments.
      Returns: ImageCollection

    创建影像数据集。影像数据集可以使用四种参数来创建,字符串(数据集名称),列表(图像的列表,或者可以创建图像的列表),单独的一幅影像,计算结果(转换为数据集)
    输入参数:创建影像数据集对象参数

    1. ee.ImageCollection.median()
      Reduces an image collection by calculating the median of all values at each pixel across the stack of all matching bands. Bands are matched by name.
      Arguments:
      this:collection (ImageCollection):
      The image collection to reduce.
      Returns: Image

    计算影像数据集的中值
    输入参数:影像数据集

    1. ee.FeatureCollection()
      FeatureCollections can be constructed from the following arguments:
    • A string: assumed to be the name of a collection.
    • A single geometry.
    • A single feature.
    • A list of features.
    • A computed object: reinterpreted as a collection.
      Arguments:
      args (ComputedObject|Feature|FeatureCollection|Geometry|List<Object>|Number|String):
      The constructor arguments.
      column (String, optional):
      The name of the geometry column to use. Only useful with constructor type 1.
      Returns: FeatureCollection

    创建一个要素数据集,可以使用五种参数来创建:符串(数据集名称),单独的一个地理对象,单独的一个要素,要素列表,计算结果(转换为数据集)
    输入参数:影像数据集,属性列表

    1. ee.Image.clipToCollection()
      Clips an image to a FeatureCollection. The output bands correspond exactly the input bands, except data not covered by the geometry of at least one feature from the collection is masked. The output image retains the metadata of the input image.
      Arguments:
      this:input (Image):
      The image to clip.
      collection (Object):
      The FeatureCollection to clip to.
      Returns: Image

    影像按照要素集进行裁切。输入参数:影像对象,要素集(裁切边界)

    相关文章

      网友评论

        本文标题:GEE组合图像,边界裁切

        本文链接:https://www.haomeiwen.com/subject/xwprrqtx.html