The standard sequence-modifying functions apply: round, setInterp, shiftTime, scaleTime, shiftScaleTime, deleteTimestamp, etc.
Round all numeric components to a given number of decimal places
round(trgeometry,integer) → trgeometry
The coordinates of the reference geometry, a polygon or a polyhedral surface, are rounded as those of the poses are.
SELECT asText(round( trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0)); Pose(Point(1.123456789 1.123456789), 0.123456)@2001-01-01', 3)); -- POLYGON((0 0,1 0,1 1,0 1,0 0));Pose(POINT(1.123 1.123),0.123)@...
Extract the subsequences where the temporal rigid geometry stays within an area with a specified maximum size for at least the given duration
stops(trgeometry,maxdist float=0.0,minduration interval='0 minutes') → trgeometry
The size of the area is the greatest distance between two positions of the pose of the subsequence, so a body that turns in place stays within it, and the distance and the bounds of a stop are as stated for a temporal point in stops.
SELECT asText(stops(trgeometry 'Polygon((0 0,1 0,1 1,0 0));[Pose(Point(1 1),0)@2001-01-01,
Pose(Point(1 1),0)@2001-01-02, Pose(Point(5 5),0)@2001-01-03, Pose(Point(5 5),0)@2001-01-04]'));
-- POLYGON((0 0,1 0,1 1,0 0));{[Pose(POINT(1 1),0)@2001-01-01, Pose(POINT(1 1),0)@2001-01-02],
-- [Pose(POINT(5 5),0)@2001-01-03, Pose(POINT(5 5),0)@2001-01-04]}
Transform to a spatial reference identifier
transform(trgeometry,integer) → trgeometry transformPipeline(trgeometry,pipeline text,srid integer, is_forward boolean=true) → trgeometry
The reference geometry is the shape of the body in its own frame, which a change of the reference system of the poses leaves as it is. The poses are transformed as those of a tpose, each orientation turning by the angle between the two systems at its position, so that the body keeps its shape and faces the same direction on the ground. The body is placed in the plane of the reference system of its poses, so the target system is not geographic.
SELECT asEWKT(round(transform(trgeometry 'SRID=4326;Polygon((-10 -5,50 -5,50 5,-10 5,-10 -5)); Pose(Point(4.35 50.85), 0.5)@2001-01-01', 32631), 3)); -- SRID=32631;POLYGON((-10 -5,50 -5,50 5,-10 5,-10 -5));Pose(POINT(595032.295 5634012.833),0.518)@2001-01-01
Convert between linear and step interpolations
setInterp(trgeometry,text) → trgeometry
SELECT asText(setInterp(trgeometry 'Interp=Step;Polygon((0 0,1 0,1 1,0 1,0 0));
[Pose(Point(0 0), 0.0)@2001-01-01, Pose(Point(10 0), 0.0)@2001-01-02]', 'linear'));
-- POLYGON((0 0,1 0,1 1,0 1,0 0));
-- {[Pose(POINT(0 0),0)@2001-01-01, Pose(POINT(0 0),0)@2001-01-02),
-- [Pose(POINT(10 0),0)@2001-01-02]}
Shift, scale, or both shift and scale the time domain of a trgeometry
shiftTime(trgeometry,interval) → trgeometry scaleTime(trgeometry,interval) → trgeometry shiftScaleTime(trgeometry,interval,interval) → trgeometry
SELECT asText(shiftTime(trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0)); [Pose(Point(0 0), 0.0)@2001-01-01, Pose(Point(10 0), 0.0)@2001-01-02]', interval '1 day')); -- POLYGON((0 0,1 0,1 1,0 1,0 0)); -- [Pose(POINT(0 0),0)@2001-01-02, Pose(POINT(10 0),0)@2001-01-03] SELECT asText(scaleTime(trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0)); [Pose(Point(0 0), 0.0)@2001-01-01, Pose(Point(10 0), 0.0)@2001-01-02]', interval '2 days')); -- POLYGON((0 0,1 0,1 1,0 1,0 0)); -- [Pose(POINT(0 0),0)@2001-01-01, Pose(POINT(10 0),0)@2001-01-03] SELECT asText(shiftScaleTime(trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0)); [Pose(Point(0 0), 0.0)@2001-01-01, Pose(Point(10 0), 0.0)@2001-01-02]', interval '1 day', interval '2 days')); -- POLYGON((0 0,1 0,1 1,0 1,0 0)); -- [Pose(POINT(0 0),0)@2001-01-02, Pose(POINT(10 0),0)@2001-01-04]
Transform a nonlinear trgeometry into a set of rows, one per distinct pose, each one is a pair composed of the reference geometry with the pose applied and the period set during which the trgeometry takes that pose
unnest(trgeometry) → {(value,time)}
SELECT ST_AsText((un).value), (un).time
FROM (SELECT unnest(trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));
{Pose(Point(0 0), 0.0)@2001-01-01, Pose(Point(4 0), 0.0)@2001-01-02,
Pose(Point(0 0), 0.0)@2001-01-03}') AS un) t;
-- POLYGON((0 0,1 0,1 1,0 1,0 0)) | {[2001-01-01, 2001-01-01], [2001-01-03, 2001-01-03]}
-- POLYGON((4 0,5 0,5 1,4 1,4 0)) | {[2001-01-02, 2001-01-02]}
SELECT ST_AsText(ST_SnapToGrid((un).value, 0.000001)), (un).time
FROM (SELECT unnest(merge(
trgeometry(geometry 'Polygon((0 0,1 0,1 1,0 1,0 0))',
pose(geometry 'Point(0 0)', 0), timestamptz '2001-01-01'),
trgeometry(geometry 'Polygon((0 0,1 0,1 1,0 1,0 0))',
pose(geometry 'Point(3 2)', pi() / 2), timestamptz '2001-01-02'))) AS un) t;
-- POLYGON((0 0,1 0,1 1,0 1,0 0)) | {[2001-01-01, 2001-01-01]}
-- POLYGON((3 2,3 3,2 3,2 2,3 2)) | {[2001-01-02, 2001-01-02]}
The pose is applied to the reference geometry in every row of the result: the value of a row is the reference geometry rotated by the orientation of the pose and then translated to its position, the geometry that startValue and valueAtTimestamp return at that pose. In the second example the pose rotates the square by 90° and moves it to (3, 2). A reference geometry that a rotation maps onto itself yields rows with equal geometries, one per pose.
Return a temporal value translated by given offsets
translate(trgeometry,deltax float,deltay float,deltaz float=0) → trgeometry
A vertical offset takes a two-dimensional value out of its plane, so the result is three-dimensional.
The motion moves the pose of every instant and keeps the reference geometry. A motion that takes a two-dimensional value out of its plane takes the reference geometry with it, in the plane z = 0.
The motion is a planar map, so a geodetic value raises an error.
SELECT asText(translate(trgeometry 'Polygon((0 0,2 0,2 1,0 1,0 0)); [Pose(Point(1 1),0.3)@2001-01-01, Pose(Point(3 2),1.1)@2001-01-02]', 1, 2), 6); /* POLYGON((0 0,2 0,2 1,0 1,0 0));[Pose(POINT(2 3),0.3)@2001-01-01, Pose(POINT(4 4),1.1)@2001-01-02] */
Return a temporal value rotated counter-clockwise about the origin or about a point
rotate(trgeometry,angle float) → trgeometry rotate(trgeometry,angle float,x0 float,y0 float) → trgeometry
The motion moves the pose of every instant and keeps the reference geometry. A motion that takes a two-dimensional value out of its plane takes the reference geometry with it, in the plane z = 0.
The motion is a planar map, so a geodetic value raises an error.
SELECT asText(rotate(trgeometry 'Polygon((0 0,2 0,2 1,0 1,0 0)); [Pose(Point(1 1),0.3)@2001-01-01, Pose(Point(3 2),1.1)@2001-01-02]', 0.7, 1, 1), 6); /* POLYGON((0 0,2 0,2 1,0 1,0 0));[Pose(POINT(1 1),1)@2001-01-01, Pose(POINT(1.885467 3.053278),1.8)@2001-01-02] */
Return a temporal value rotated counter-clockwise about the x axis
rotateX(trgeometry,angle float) → trgeometry
The rotation takes a two-dimensional value out of its plane, so the result is three-dimensional: each position gains the height the rotation gives it, and each orientation is the rotation composed with the angle about the vertical that the value states.
The motion moves the pose of every instant and keeps the reference geometry. A motion that takes a two-dimensional value out of its plane takes the reference geometry with it, in the plane z = 0.
The motion is a planar map, so a geodetic value raises an error.
SELECT asText(rotateX(trgeometry 'Polygon((0 0,2 0,2 1,0 1,0 0)); [Pose(Point(1 1),0.3)@2001-01-01, Pose(Point(3 2),1.1)@2001-01-02]', 0.7), 6); /* POLYGON Z ((0 0 0,2 0 0,2 1 0,0 1 0,0 0 0)); [Pose(POINT Z (1 0.764842 0.644218),0.928825,0.339047,-0.051242,0.140378)@2001-01-01, Pose(POINT Z (3 1.529684 1.288435),0.800838,0.292329,-0.179228,0.490998)@2001-01-02] */
Return a temporal value rotated counter-clockwise about the y axis
rotateY(trgeometry,angle float) → trgeometry
The rotation takes a two-dimensional value out of its plane, so the result is three-dimensional: each position gains the height the rotation gives it, and each orientation is the rotation composed with the angle about the vertical that the value states.
The motion moves the pose of every instant and keeps the reference geometry. A motion that takes a two-dimensional value out of its plane takes the reference geometry with it, in the plane z = 0.
The motion is a planar map, so a geodetic value raises an error.
Return a temporal value rotated counter-clockwise about the z axis
rotateZ(trgeometry,angle float) → trgeometry
The motion moves the pose of every instant and keeps the reference geometry. A motion that takes a two-dimensional value out of its plane takes the reference geometry with it, in the plane z = 0.
The motion is a planar map, so a geodetic value raises an error.
Return a temporal rigid geometry projected to the ground
force2D(trgeometry) → trgeometry
The reference geometry loses its Z and each pose is projected as force2D projects a temporal pose, so the functions in two dimensions answer about the ground: in the second example, two flat bodies at different heights touch. A reference geometry that is not a polygon in a plane gives an error, and a value in two dimensions stays as it is.
SELECT asText(force2D(trgeometry 'Polygon((-2 -1 0,2 -1 0,2 1 0,-2 1 0,-2 -1 0));
[Pose(Point(0 0 0),1,0,0,0)@2001-01-01,
Pose(Point(10 0 0),0.7071067811865476,0,0,0.7071067811865476)@2001-01-02]'), 6);
/* POLYGON((-2 -1,2 -1,2 1,-2 1,-2 -1));[Pose(POINT(0 0),0)@2001-01-01,
Pose(POINT(10 0),1.570796)@2001-01-02] */
SELECT round(nearestApproachDistance(
force2D(trgeometry 'Polygon((-2 -1 0,2 -1 0,2 1 0,-2 1 0,-2 -1 0));
[Pose(Point(0 0 0),1,0,0,0)@2001-01-01, Pose(Point(10 0 0),1,0,0,0)@2001-01-02]'),
force2D(trgeometry 'Polygon((-2 -1 0,2 -1 0,2 1 0,-2 1 0,-2 -1 0));
[Pose(Point(5 0 0.8),1,0,0,0)@2001-01-01, Pose(Point(5 0 0.8),1,0,0,0)@2001-01-02]'))::numeric, 6);
-- 0.000000