在GEE中,可以使用.geometry()方法来获取几何形状的中心点坐标和相交的坐标。
首先,使用.geometry()方法获取几何形状的几何信息,然后使用.centroid()方法获取几何形状的中心点坐标。示例代码如下:
要获取几何形状的相交的坐标,可以使用.intersection()方法。首先,创建一个与其他几何形状相交的几何形状,然后使用.intersection()方法获取相交的几何形状。示例代码如下:
注意,当几何形状没有相交的部分时,intersection()方法将返回一个空的几何形状。在代码中,你可以使用.isEmpty()方法来检查几何形状是否为空。
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.
返回几何体最高维度分量的中心点。低维组件将被忽略,因此包含两个多边形、三条线和一个点的几何体的中心点等同于仅包含两个多边形的几何体的中心点。
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 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.
返回给定几何体的凸壳。单个点的凸面形是点本身,相邻点的凸面形是一条直线,其他所有点的凸面形是一个多边形。需要注意的是,如果一个退化多边形的所有顶点都在同一条直线上,那么该多边形将生成一条线段。
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.
[-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]