前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >GEE训练教程——如何确定几何形状的中心点坐标和相交的坐标

GEE训练教程——如何确定几何形状的中心点坐标和相交的坐标

作者头像
此星光明
发布2024-06-11 08:29:12
1010
发布2024-06-11 08:29:12
举报

简介

在GEE中,可以使用.geometry()方法来获取几何形状的中心点坐标和相交的坐标。

首先,使用.geometry()方法获取几何形状的几何信息,然后使用.centroid()方法获取几何形状的中心点坐标。示例代码如下:

要获取几何形状的相交的坐标,可以使用.intersection()方法。首先,创建一个与其他几何形状相交的几何形状,然后使用.intersection()方法获取相交的几何形状。示例代码如下:

注意,当几何形状没有相交的部分时,intersection()方法将返回一个空的几何形状。在代码中,你可以使用.isEmpty()方法来检查几何形状是否为空。

函数

centroid(maxErrorproj)

Returns a point at the center of the highest-dimension components of the geometry. Lower-dimensional components are ignored, so the centroid of a geometry containing two polygons, three lines and a point is equivalent to the centroid of a geometry containing just the two polygons.

返回几何体最高维度分量的中心点。低维组件将被忽略,因此包含两个多边形、三条线和一个点的几何体的中心点等同于仅包含两个多边形的几何体的中心点。

Arguments:

this:geometry (Geometry):

Calculates the centroid of this geometry.

maxError (ErrorMargin, default: null):

The maximum amount of error tolerated when performing any necessary reprojection.

proj (Projection, default: null):

If specified, the result will be in this projection. Otherwise it will be in WGS84.

Returns: Geometry

convexHull(maxErrorproj)

Returns the convex hull of the given geometry. The convex hull of a single point is the point itself, the convex hull of collinear points is a line, and the convex hull of everything else is a polygon. Note that a degenerate polygon with all vertices on the same line will result in a line segment.

返回给定几何体的凸壳。单个点的凸面形是点本身,相邻点的凸面形是一条直线,其他所有点的凸面形是一个多边形。需要注意的是,如果一个退化多边形的所有顶点都在同一条直线上,那么该多边形将生成一条线段。 

Arguments:

this:geometry (Geometry):

Calculates the convex hull of this geometry.

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.

Returns: Geometry

代码

原始坐标

[-110.32626262349595,40.55855252455285]

[-110.32598903817643,40.55829576296057]

坐标中心点

[-110.3261258308334,40.55842414376022]

结果

代码

由两条直线构建成的多边形

 这样我们就能获取一个多边形,根据多边形来选取出相交点的坐标。

根据坐标函数来获取具体的坐标

List (1 element)

0:List (4 elements)

0:[-110.3243276020209,40.558460268786476]

1:[-110.32475273214978,40.558423588568765]

2:[-110.32454486095111,40.55831456669189]

3:[-110.3243276020209,40.558460268786476]

线段进行边界转化

其他代码

第一种情况

第二种情况

第三种情况 

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-06-10,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 简介
  • 函数
    • centroid(maxError, proj)
      • Arguments:
      • Returns: Geometry
    • convexHull(maxError, proj)
      • Arguments:
      • Returns: Geometry
  • 代码
  • 原始坐标
  • 结果
  • 代码
  • 线段进行边界转化
  • 其他代码
    • 第一种情况
      • 第二种情况
        • 第三种情况 
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档