ST_Last — Returns the last geometry of a set of geometries.
PostgreSQL
geometry ST_Last(bytea
Aggregate);
H2
geometry ST_LastAgg(bytea
Aggregate);
Returns the last geometry of a set of geometries.
| 2D | 3D | M |
|---|---|---|
![]() | ![]() | ![]() |
| 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 |
|---|---|---|---|
| - | - | - | - |
//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)