美文网首页GEE案例
GEE使用表格生成要素集

GEE使用表格生成要素集

作者: 赤豆冰棍 | 来源:发表于2019-01-08 00:50 被阅读0次

    使用表格生成要素集

    主要功能

    使用在线数据筛选生成要素集

    代码

    // Create a FeatureCollection from a Fusion Table.
    
    // Select "desert" features from the TNC Ecoregions fusion table.
    var fc = ee.FeatureCollection('ft:1Ec8IWsP8asxN-ywSqgXWMuBaxI6pPaeh6hC64lA')
      .filter(ee.Filter.stringContains('ECO_NAME', 'desert'));
    
    // Paint into a blank image.  Cast to byte() so we can use more than 1 color.
    var image1 = ee.Image().byte().paint(fc, 'ECO_NUM');
    
    // Display the image using random colors for each value.
    Map.setCenter(-109.687, 30.524, 5);
    Map.addLayer(image1.randomVisualizer());
    

    步骤分析

    1. 使用在线数据,筛选字段属性
    2. 将筛选出的要素输出到一个数据对象中
    3. 设置地图中心,缩放等级
    4. 添加图层,展示结果

    主要方法

    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.Filter.stringContains()
      Creates a unary or binary filter that passes if the left operand, a string, contains the right operand, also a string.
      Arguments:
      leftField (String, default: null):
      A selector for the left operand. Should not be specified if leftValue is specified.
      rightValue (Object, default: null):
      The value of the right operand. Should not be specified if rightField is specified.
      rightField (String, default: null):
      A selector for the right operand. Should not be specified if rightValue is specified.
      leftValue (Object, default: null):
      The value of the left operand. Should not be specified if leftField is specified.
      Returns: Filter

    过滤器,判断是否包含特定字符串。
    输入参数:左属性(字符串),右值,右属性(字符串),左值

    1. ee.Image.paint()
      Paints the geometries of a collection onto an image.
      Arguments:
      this:image (Image):
      The image on which the collection is painted.
      featureCollection (FeatureCollection):
      The collection painted onto the image.
      color (Object, default: 0):
      Either the name of a color property or a number.
      width (Object, default: null):
      Either the name of a line-width property or a number.
      Returns: Image

    将地理几何要素输出到为影像数据。
    输入参数:影像(输出结果),要素集,颜色,宽度

    1. ee.Image.randomVisualizer()
      Creates a vizualization image by assigning a random color to each unique value of the pixels of the first band. The first three bands of the output image will contan 8-bit R, G and B values, followed by all bands of the input image.
      Arguments:
      this:image (Image):
      Image with at least one band.
      Returns: Image

    对影像数据的第一波段中的不同值赋予随机颜色输出彩色图像,输出结果为8位RGB影像
    输入参数:影像对象(需至少包含一个波段)

    相关文章

      网友评论

        本文标题:GEE使用表格生成要素集

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