使用與參考手冊

ST_StartPoint

ST_StartPoint 使用一個線串並傳回一個點,該點是此線串的第一個點。

語法

db2gse.ST_StartPoint(c db2gse.ST_Curve)

回覆類型

db2gse.ST_Point

範例

下列 CREATE TABLE 陳述式建立 STARTPOINT_TEST 表格。 STARTPOINT_TEST 有兩個直欄:GID 整數直欄 (它唯一識別表格的列) 和 LN1 線串直欄。

CREATE TABLE STARTPOINT_TEST (gid integer, ln1 db2gse.ST_LineString)

下列 INSERT 陳述式將線串插入 LN1 直欄。 第一個線串沒有 Z 座標或測量,第二個線串有 Z 座標和測量。

INSERT INTO STARTPOINT_TEST VALUES(1,
db2gse.ST_LineFromText('linestring (10.02 20.01,23.73
21.92,30.10 40.23)', db2gse.coordref()..srid(0)))
INSERT INTO STARTPOINT_TEST VALUES(2,
db2gse.ST_LineFromText('linestring  zm (10.02 20.01 5.0 7.0,23.73 21.92 6.5 7.1,30.10
40.23 6.9 7.2)', db2gse.coordref()..srid(0)))

下列 SELECT 陳述式和對應的結果集顯示 ST_StartPoint 函數如何取出每一線串的第一個點。 ST_AsText 函數將此點轉換成它的文字格式。列示中的第一個點沒有 Z 座標或測量, 第二個點有 Z 座標和測量,因為來源線串有這兩者。

SELECT gid, CAST(db2gse.ST_AsText(db2gse.ST_StartPoint (ln1)) as varchar(60)) "Startpoint"
FROM STARTPOINT_TEST
GID         Startpoint
----------- ------------------------------------------------------------
          1 POINT ( 10.02000000 20.01000000)
          2 POINT ZM ( 10.02000000 20.01000000 5.00000000 7.00000000)
  2 record(s) selected. 


[ 頁面頂端 | 前一頁 | 下一頁 | 目錄 | 索引 ]