美文网首页GEE案例
GEE使用多边形创建要素集

GEE使用多边形创建要素集

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

使用多边形创建要素集

主要功能

使用自定义的多边形来创建要素集

代码

// Create and render a feature collection from polygons.

// Construct a FeatureCollection from a list of features.
var fc = ee.FeatureCollection([
  // Create each feature with a geometry and properties.
  ee.Feature(
      ee.Geometry.Polygon({
        coords: [[-109.05, 41], [-109.05, 37], [-102.05, 37], [-102.05, 41]],
        geodesic: false, // The state boundaries are not geodesic.
        maxError: 1000 // Make the error margin large; we don't need accuracy.
      }), {name: 'Colorado', fill: 1}), // Pass properties as a dictionary.
  ee.Feature(
      ee.Geometry.Polygon({
        coords: [
          [-114.05, 37.0], [-109.05, 37.0], [-109.05, 41.0],
          [-111.05, 41.0], [-111.05, 42.0], [-114.05, 42.0]
        ],
        geodesic: false,
        maxError: 1000
      }), {name: 'Utah', fill: 2})
]);

// Fill, then outline the polygons into a blank image.
var image = ee.Image().toByte()
    .paint(fc, 'fill') // Get color from property named 'fill'
    .paint(fc, 3, 5); // Outline using color 3, width 5.

Map.addLayer(image, {
    palette: ['000000', 'FF0000', '00FF00', '0000FF'],
    max: 3,
    opacity: 0.5
});

Map.setCenter(-107, 41, 6);

步骤分析

  1. 使用拐点坐标和属性列表来创建若干个地理要素
  2. 使要素集包含创建的地理要素对象
  3. 将要素集输出为影像数据对象
  4. 添加要素对象显示图层
  5. 设置地图中心,缩放等级

主要方法

  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

综合前文,一个FeatureCollection可以只包含一个地理要素,也可以包含多个地理要素。

  1. ee.Geometry.Polygon()
    Constructs an ee.Geometry describing a polygon.
    For convenience, varargs may be used when all arguments are numbers. This allows creating geodesic EPSG:4326 Polygons with a single LinearRing given an even number of arguments, e.g. ee.Geometry.Polygon(aLng, aLat, bLng, bLat, ..., aLng, aLat).
    Arguments:
    coords (List<Geometry>|List<List<List<Number>>>|List<Number>): A list of rings defining the boundaries of the polygon. May be a list of coordinates in the GeoJSON 'Polygon' format, a list of ee.Geometry describing a LinearRing, or a list of number defining a single polygon boundary.
    proj (Projection, optional): The projection of this geometry. The default is the projection of the inputs, where Numbers are assumed to be EPSG:4326.
    geodesic (Boolean, optional): If false, edges are straight in the projection. If true, edges are curved to follow the shortest path on the surface of the Earth. The default is the geodesic state of the inputs, or true if the inputs are numbers.
    maxError (ErrorMargin, optional): Max error when input geometry must be reprojected to an explicitly requested result projection or geodesic state.
    evenOdd (Boolean, optional): If true, polygon interiors will be determined by the even/odd rule, where a point is inside if it crosses an odd number of edges to reach a point at infinity. Otherwise polygons use the left- inside rule, where interiors are on the left side of the shell's edges when walking the vertices in the given order. If unspecified, defaults to true.
    Returns: Geometry.Polygon

创建多边形的地理要素,默认使用ESPG:4326地理坐标系。
输入参数:地理坐标(一系列点),投影信息,geodesic(布尔值,控制地理要素是否贴合投影坐标系),容差,everOdd(布尔值,控制复杂多边形构建)

相关文章

  • GEE使用多边形创建要素集

    使用多边形创建要素集 主要功能 使用自定义的多边形来创建要素集 代码 步骤分析 使用拐点坐标和属性列表来创建若干个...

  • GEE影像数据集裁剪

    影像数据集裁剪过滤 主要功能 对影像数据集进行要素裁剪,使用边界来获取特定区域数据。 代码 步骤分析 创建多边形对...

  • GEE使用表格生成要素集

    使用表格生成要素集 主要功能 使用在线数据筛选生成要素集 代码 步骤分析 使用在线数据,筛选字段属性 将筛选出的要...

  • ArcGIS常用工具:union、merge、append、di

    1、union(联合) 要求输入的要素必须是多边形,即求得两个及以上多边形的并集,对输入要素的属性字段没有要求,输...

  • Dynamo For Revit: 简单体量的创建

    概述 使用ByLoft的方式用两个多边形创建体量。 Case 1:多边形的形状相同 步骤 创建一个圆 用这个圆做一...

  • GEE学习笔记 七

    GEE中的JavaScript简单介绍 正式进入GEE编程,这里先简单讲一下GEE开发使用的编程语言。网页端的工作...

  • GEE学习笔记 一

    初识GEE GEE简介GEE应用范围GEE优缺点GEE初识 1.GEE是什么? GEE(全称Google Eart...

  • GEE学习笔记 零

    GEE初识 GEE示例以及学习资源介绍 GEE工作台介绍 GEE资源查找 GEE资源上传 GEE资源导出 GEE控...

  • Geetest-java使用教程

    首先获取官方sdkGitHub - GeeTeam/gt-java-sdk: GtWebJspDemo 创建Gee...

  • quick-cocos2d-x之画多边形

    画多边形使用的类为CCPolygonShape,创建一个CCPolygonShape对象时需要传入一个CCPoin...

网友评论

    本文标题:GEE使用多边形创建要素集

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