GEE使用表格生成要素集

使用表格生成要素集

主要功能

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

代码

// 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影像
输入参数:影像对象(需至少包含一个波段)

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 9,505评论 0 13
  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,449评论 0 10
  • 我们总是有一种错觉; 我们总是以自己最不喜欢的方式成熟; 我们对未来认知,一半为偏见,另外一半就是猜测; 未来总是...
    丰牛阅读 158评论 0 1
  • 第二次学习的开始还是先热身,随后先复习上节课的直滑降几趟,然后进入今天的课程学习“J型转弯”,顾名思义,就是在直滑...
    yuzideyuzi阅读 584评论 0 0
  • 1.基本概念:DOM事件的级别DOM0 element.onclick = function(){} 在js中:添...
    唐卡豆子阅读 305评论 0 0