ST_StartPoint

Definición

ST_StartPoint devuelve el primer punto de una cadena de texto de líneas

Sintaxis

Oracle y PostgreSQL

sde.st_startpoint (ln1 sde.st_geometry)

SQLite

st_startpoint (ln1 geometryblob)

Tipo de devolución

ST_Point

Ejemplos

La tabla startpoint_test se crea con la columna de enteros gid, que identifica exclusivamente las filas de la tabla, y la columna de ST_LineString ln1.

Las declaraciones INSERT insertan la ST_LineStrings en la columna ln1. El primer ST_LineString no tiene coordenadas z o medidas, mientras que la segunda ST_LineString tiene ambas.

La función ST_StartPoint extrae el primer punto de cada ST_LineString. El primer punto de la lista no tiene una coordenada z o de medida, mientras que el segundo punto tiene ambas, ya que la cadena de texto de líneas de origen las tiene.

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)

Temas relacionados

5/10/2014