Name

ST_Last — Returns the last geometry of a set of geometries.

Synopsis

PostgreSQL

geometry ST_Last(bytea Aggregate);

H2

geometry ST_LastAgg(bytea Aggregate);

Alias

Last

Description

Returns the last geometry of a set of geometries.

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006))SQL-MM Part 3
----

Examples

//Create a table and populate data into it:
CREATE TABLE "gps_points"(id serial PRIMARY KEY);
SELECT AddGeometryColumn ('gps_points','geom',-1,'POINT',2);
INSERT INTO "gps_points" ("geom") VALUES (ST_GeomfromEWKT('POINT(0 0)'));
INSERT INTO "gps_points" ("geom") VALUES (ST_GeomfromEWKT('POINT(10 10)'));
INSERT INTO "gps_points" ("geom") VALUES (ST_GeomfromEWKT('POINT(15 15)'));

PostgreSQL

select asewkt(ST_Last("gps_points"."geom")) from "gps_points";
--Result
 POINT (15 15)

H2

select asewkt(ST_LastAgg("gps_points"."geom")) from "gps_points";
--Result
 POINT (15 15)

Related functions

ST_EndPoint