ST_StartPoint

定义

ST_StartPoint 用于返回线串的第一个点。

语法

Oracle 和 PostgreSQL

sde.st_startpoint (ln1 sde.st_geometry)

SQLite

st_startpoint (ln1 geometryblob)

返回类型

ST_Point

示例

创建 startpoint_test 表,表中包含用于唯一识别表格行的 gid 整型列和 ln1 ST_LineString 列。

INSERT 语句用于将 ST_LineStrings 插入到 ln1 列中。第一个 ST_LineString 没有 z 坐标或度量值,而第二个 ST_LineString 具有这两者。

ST_StartPoint 函数用于提取各 ST_LineString 的第一个点。列表中的第一个点不包含 z 坐标或度量值,而第二个点则包含这两个值,这是因为此源线串具有这二个属性。

Oracle

CREATE TABLE startpoint_test (
 gid integer,
 ln1 sde.st_geometry
);
INSERT INTO STARTPOINT_TEST VALUES (
 1,
 sde.st_linefromtext ('linestring (10.02 20.01, 23.73 21.92, 30.10 40.23)', 4326)
);

INSERT INTO STARTPOINT_TEST VALUES (
 2,
 sde.st_linefromtext ('linestring zm(10.02 20.01 5 7, 23.73 21.92 6.5 7.1, 30.10 40.23 6.9 7.2)', 4326)
);
SELECT gid, sde.st_astext (sde.st_startpoint (ln1)) Startpoint
 FROM STARTPOINT_TEST;

GID  Startpoint

1    POINT (10.02000000 20.01000000)
2    POINT ZM (10.02000000 20.01000000 5.00000000 7.00000000)

PostgreSQL

CREATE TABLE startpoint_test (
 gid serial,
 ln1 sde.st_geometry
);
INSERT INTO startpoint_test (ln1) VALUES (
 sde.st_linestring ('linestring (10.02 20.01, 23.73 21.92, 30.10 40.23)', 4326)
);

INSERT INTO startpoint_test (ln1) VALUES (
 sde.st_linestring ('linestring zm(10.02 20.01 5 7, 23.73 21.92 6.5 7.1, 30.10 40.23 6.9 7.2)', 4326)
);
SELECT gid, sde.st_astext (sde.st_startpoint (ln1)) 
 AS Startpoint
 FROM startpoint_test;

gid  startpoint

1    POINT (10.02000000 20.01000000)
2    POINT ZM (10.02000000 20.01000000 5.00000000 7.00000000)

SQLite

CREATE TABLE startpoint_test (
 gid integer primary key autoincrement not null
);

SELECT AddGeometryColumn(
 NULL,
 'startpoint_test',
 'ln1',
 4326,
 'linestringzm',
 'xyzm',
 'null'
);
INSERT INTO startpoint_test (ln1) VALUES (
 st_linestring ('linestring (10.02 20.01, 23.73 21.92, 30.10 40.23)', 4326)
);

INSERT INTO startpoint_test(ln1) VALUES (
 st_linestring ('linestring zm(10.02 20.01 5 7, 23.73 21.92 6.5 7.1, 30.10 40.23 6.9 7.2)', 4326)
);
SELECT gid, st_astext (st_startpoint (ln1)) 
 AS "Startpoint"
 FROM startpoint_test;

gid  Startpoint

1    POINT (10.02000000 20.01000000)
2    POINT ZM (10.02000000 20.01000000 5.00000000 7.00000000)

相关主题

5/25/2014