返回給定Geometry對象的邊界。

語法

geometry  ST_Boundary(geometry  geomA);

參數

參數名稱 描述
geomA 目標Geometry對象。

描述

該函數支持3D對象,并且不會刪除Z坐標。

示例

  • POINT的邊界返回空的GEOMETRYCOLLECTION:
    SELECT ST_AsText(ST_Boundary('POINT(1 0)'::geometry));
            st_astext
    --------------------------
     GEOMETRYCOLLECTION EMPTY
    (1 row)
                        
  • LINESTRING的邊界返回MULTIPOINT:
    SELECT ST_AsText(ST_Boundary('LINESTRINGM(1 0 1, 2 0 2)'::geometry));
          st_astext
    ---------------------
     MULTIPOINT(1 0,2 0)
    (1 row)
                        
  • POLYGON的邊界返回LINESTRING:
    SELECT ST_AsText(ST_Boundary('POLYGON((1 0, 2 0,0 2,1 0))'::geometry));
              st_astext
    -----------------------------
     LINESTRING(1 0,2 0,0 2,1 0)
    (1 row)
                        
  • 有洞的POLYGON的邊界返回MULTILINESTRING:
    SELECT ST_AsText(ST_Boundary('POLYGON((1 0,3 0,0 3,1 0),(1 0 ,2 0, 0 2 ,1 0))'::geometry));
                          st_astext
    ------------------------------------------------------
     MULTILINESTRING((1 0,3 0,0 3,1 0),(1 0,2 0,0 2,1 0))
    (1 row)