ST_Centroid(geometry) 函数
2018-10-18 15:05 更新
ST_Centroid(geometry) 函数 -= 作用:
获取几何对象的中心点
语法:
ST_Centroid (geometry Data Type)
返回类型:
PostGis return type: geometry
Examples: 例 1:
SELECT ST_Centroid('MULTIPOINT ( -1 0, -1 2, -1 3, -1 4, -1 7, 0 1, 0 3, 1 1, 2 0, 6 0, 7 8, 9 8, 10 6 )');
------------------------------------------
010100000062277662277602406227766227760A40
例 2:
SELECT ST_AsText(ST_Centroid('MULTIPOINT ( -1 0, -1 2, -1 3, -1 4, -1 7, 0 1, 0 3, 1 1, 2 0, 6 0, 7 8, 9 8, 10 6 )'));
------------------------------------------
POINT(2.30769230769231 3.30769230769231)
(1 row)
例 3:
SELECT st_asgeojson(ST_Centroid('MULTIPOINT ( -1 0, -1 2, -1 3, -1 4, -1 7, 0 1, 0 3, 1 1, 2 0, 6 0, 7 8, 9 8, 10 6 )'));
---------------------------------------
{"type":"Point","coordinates":[2.30769230769231,3.30769230769231]}
参考文献:
1.https://docs.microsoft.com/zh-cn/sql/t-sql/spatial-geometry/stcentroid-geometry-data-type
以上内容是否对您有帮助:
更多建议: