GEE数据集距离计算

标记特定像素

主要功能

标记大于1000m的像素点,标记等于1000m的像素点

代码

// Collection.distance example.
// Computes the distance to the nearest feature in a collection.

// Construct a FeatureCollection from a list of geometries.
var fc = ee.FeatureCollection([
  ee.Geometry.Point(-72.94411, 41.32902),
  ee.Geometry.Point(-72.94411, 41.33402),
  ee.Geometry.Point(-72.94411, 41.33902),
  // The geometries do not need to be the same type.
  ee.Geometry.LineString(
      -72.93411, 41.30902, -72.93411, 41.31902, -72.94411, 41.31902)
]);

// Compute distance from the dfeatures, to a max of 1000 meters.
var distance = fc.distance(1000, 100);

Map.setCenter(-72.94, 41.32, 13);
Map.addLayer(distance, {min: 0, max: 1000, palette: ['yellow', 'red']});
Map.addLayer(fc);

步骤分析

  1. 创建ee对象,使用自定义坐标来创建的了点和线的混合要素集合。
  2. 计算与要素距离在设置范围中的部分。
  3. 添加图层,设置显示方式。

主要方法

  1. ee.feature.distance()
    Returns the minimum distance between the geometries of two features.
    Arguments:
    this:left (Element): The feature containing the geometry used as the left operand of the operation.
    right (Element): The feature containing the geometry used as the right operand of the operation.
    maxError (ErrorMargin, default: null): The maximum amount of error tolerated when performing any necessary reprojection.
    proj (Projection, default: null): The projection in which to perform the operation. If not specified, the operation will be performed in a spherical coordinate system, and linear distances will be in meters on the sphere.

计算两个地理要素之间的最小距离。
输入参数: 左操作数(计算结果)、右操作数(计算使用的要素)、容差、投影坐标系。
返回值:浮点型地理要素距离计算结果。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • d3 (核心部分)选择集d3.select - 从当前文档中选择一系列元素。d3.selectAll - 从当前文...
    谢大见阅读 8,803评论 1 4
  • 声明:作者翻译论文仅为学习,如有侵权请联系作者删除博文,谢谢! 翻译论文汇总:https://github.com...
    SnailTyan阅读 14,355评论 3 13
  • 以前我对自己的未来无数次想象过 会做什么工作 遇见什么样的人 过什么样的生活 我统统都幻想过 给自己假设了很多各种...
    小緈運阅读 1,607评论 0 0
  • 看完第四章了,边看也边在想,这位老师看来真不打算重复《真》里面的内容。 要想获得紧密充满爱的婚姻, 两者的比例 需...
    周娜Zhou阅读 1,535评论 0 0
  • 中学毕业那一年, 父亲给予的一次旅行奖励唤醒了我看世界的心。 那一年, 我十五岁, 爸爸为奖励我以优秀的成绩中学毕...
    绿洲玫瑰阅读 4,753评论 2 4

友情链接更多精彩内容