Geometry centroid(几何质心(Geometry centroid))¶
Supported in: Batch, Streaming
Return the centroid, or "center of mass", of the geometry using a spherical approximation of the globe. If the geometry is a collection of mixed dimensions, only the elements of the highest dimension will contribute to the centroid (e.g. in a collection of points, lines and polygons, points and lines are ignored). This operation will round to 32-bit floating point precision for coordinates in the geometry.
Expression categories: Geospatial
Declared arguments¶
- Expression: Valid GeoJSON input.
Expression\
Output type: GeoPoint
Examples¶
Example 1: Base case¶
Argument values:
- Expression:
geometry
| geometry | Output |
|---|---|
| {"type":"Polygon","coordinates":[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[-1.0,1.0],[-1.0,-1.0]]]} | { latitude: 0.0, longitude: 0.0, } |
| {"type":"LineString","coordinates":[[30.0,0.0],[35.0,0.0],[50.0,0.0]]} | { latitude: 0.0, longitude: 40.0, } |
| {"type":"MultiPoint","coordinates":[[0.0,0.0],[0.0,1.0]]} | { latitude: 0.5, longitude: 0.0, } |
| {"type":"MultiPoint","coordinates":[[160.0,0.0],[-170.0,0.0]]} | { latitude: 0.0, longitude: 175.0, } |
| {"type":"GeometryCollection","geometries":[{"type":"Polygon","coordinates":[[[0.0,-0.017981],[0.0017... | { latitude: 0.0, longitude: 0.0, } |
| {"type":"Polygon","coordinates":[[[10.2010565854362,-45.0511905886321],[10.20108119607644,-45.051242... | { latitude: -45.05131203645637, longitude: 10.200951037517806, } |
| null | null |
中文翻译¶
几何质心(Geometry centroid)¶
支持:批处理(Batch)、流处理(Streaming)
返回几何对象的质心(centroid),即"质量中心",基于地球的球面近似计算。如果几何对象包含混合维度的集合,则仅最高维度的元素参与质心计算(例如,在点、线和多边形的集合中,点和线将被忽略)。此操作会将几何坐标四舍五入为32位浮点精度。
表达式类别: 地理空间(Geospatial)
声明的参数¶
- 表达式(Expression): 有效的 GeoJSON 输入。
表达式\
输出类型: GeoPoint
示例¶
示例 1:基础案例¶
参数值:
- 表达式:
geometry
| geometry | 输出 |
|---|---|
| {"type":"Polygon","coordinates":[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[-1.0,1.0],[-1.0,-1.0]]]} | { 纬度(latitude):0.0, 经度(longitude):0.0, } |
| {"type":"LineString","coordinates":[[30.0,0.0],[35.0,0.0],[50.0,0.0]]} | { 纬度:0.0, 经度:40.0, } |
| {"type":"MultiPoint","coordinates":[[0.0,0.0],[0.0,1.0]]} | { 纬度:0.5, 经度:0.0, } |
| {"type":"MultiPoint","coordinates":[[160.0,0.0],[-170.0,0.0]]} | { 纬度:0.0, 经度:175.0, } |
| {"type":"GeometryCollection","geometries":[{"type":"Polygon","coordinates":[[[0.0,-0.017981],[0.0017... | { 纬度:0.0, 经度:0.0, } |
| {"type":"Polygon","coordinates":[[[10.2010565854362,-45.0511905886321],[10.20108119607644,-45.051242... | { 纬度:-45.05131203645637, 经度:10.200951037517806, } |
| null | null |