Chapter 14. Temporal Rigid Geometries

Table of Contents

Input and Output
Constructors
Conversions
Accessors
Traversed Area
Spatial Functions
Motion Metrics
Modifications
Spatial Restrictions
Distance Operations
Similarity
Comparisons
Bounding-Box Operators
Tiles
Bounding Boxes
Aggregations
Indexing

A temporal rigid geometry (trgeometry) is a static 2D reference geometry, typically a polygon describing the shape of a moving body, paired with a temporal pose (tpose) describing how that geometry translates and rotates over time. The materialised geometry at time t is the reference geometry rotated and translated according to the pose interpolated at t.

This is the natural representation for moving objects whose shape matters, not just their position. The motivating example is AIS maritime traffic, where each ship's hull (a pentagon derived from the antenna offsets A, B, C, D) follows a pose path defined by lat/lon and heading reports. The materialised geometry at any instant is the actual ship outline at that moment.

The trgeometry type builds on Chapter 13, Temporal Poses. Most accessor, comparison, topological, position, and indexing operators have the same shape as the corresponding tpose functions; this chapter covers the trgeometry-specific surface, pose-to-shape materialisation, traversed area, materialised distance, and spatial restrictions on the centroid trajectory.

Input and Output

A trgeometry literal pairs a reference geometry with a temporal pose. The reference geometry comes first, separated from the pose by a semicolon; the pose follows the standard tpose syntax (instant, sequence, or sequence set).

SELECT trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));Pose(Point(0 0), 0.5)@2001-01-01';
SELECT trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));{Pose(Point(0 0), 0.0)@2001-01-01, Pose(Point(5 0), 0.5)@2001-01-02, Pose(Point(0 0), 0.0)@2001-01-03}';
SELECT 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), 1.5)@2001-01-02]';
SELECT trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));{[Pose(Point(0 0), 0.0)@2001-01-01, Pose(Point(5 0), 0.0)@2001-01-02], [Pose(Point(0 0), 0.0)@2001-01-04, Pose(Point(2 0), 0.0)@2001-01-05]}';

The reference geometry can be any 2D polygon or polyhedral surface. The pose interpolation is linear in translation and angular-shortest-path in rotation. SRIDs are inherited from the reference geometry and the pose; they must agree.

An SRID can be specified for a trgeometry either at the begining of the literal or before the reference geometry as shown below.

SELECT trgeometry 'SRID=25832;Polygon((0 0,1 0,1 1,0 1,0 0));Pose(Point(0 0), 0.5)@2001-01-01';
SELECT trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));SRID=25832;Pose(Point(0 0), 0.5)@2001-01-01';

Step interpolation can also be specified in the same way as for other temporal types:

SELECT 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]';

The standard wire formats are supported.

  • Return the Well-Known Text (WKT) representation

    asText({trgeometry,trgeometry[]} [, maxdecimaldigits int=15]) → text

    SELECT asText(trgeometry 'Polygon((1 1,2 2,3 1,1 1));Pose(Point(1.123456789 1.123456789), 0.5)@2000-01-01', 6);
    -- POLYGON((1 1,2 2,3 1,1 1));Pose(POINT(1.123457 1.123457),0.5)@2000-01-01
    
  • Return the Extended Well-Known Text (EWKT) representation, prefixed with the SRID

    asEWKT({trgeometry,trgeometry[]} [, maxdecimaldigits int=15]) → text

    SELECT asEWKT(trgeometry 'SRID=25832;Polygon((1 1,2 2,3 1,1 1));Pose(Point(1 1),0.5)@2000-01-01');
    -- SRID=25832;POLYGON((1 1,2 2,3 1,1 1));Pose(POINT(1 1),0.5)@2000-01-01
    
  • Return the Moving Features JSON representation

    asMFJSON(trgeometry [, options int=0 [, flags int=0 [, maxdecimaldigits int=15]]]) → text

    SELECT asMFJSON(trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));Pose(Point(0 0),0)@2001-01-01');
    
  • Return the Extended Well-Known Binary (EWKB) representation

    asEWKB(trgeometry [, endian text]) → bytea

    Companion asHexEWKB returns the same bytes as a hex-encoded text.

    SELECT length(asEWKB(trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));Pose(Point(1 1), 0.5)@2001-01-01'));
    -- 130
    -- The bytes round-trip through the matching input function.
    SELECT asText(trgeometryFromHexEWKB(asHexEWKB(trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));Pose(Point(1 1), 0.5)@2001-01-01')));
    -- POLYGON((0 0,1 0,1 1,0 1,0 0));Pose(POINT(1 1),0.5)@2001-01-01
    
  • Each output format has a companion parser:

    trgeometryFromText(text) → trgeometry

    trgeometryFromEWKT(text) → trgeometry

    trgeometryFromMFJSON(text) → trgeometry

    trgeometryFromEWKB(bytea) → trgeometry

    trgeometryFromHexEWKB(text) → trgeometry

    SELECT asText(trgeometryFromEWKT('SRID=4326;Polygon((0 0,1 0,1 1,0 1,0 0));
      Pose(Point(1 1), 0.5)@2001-01-01'));
    -- POLYGON((0 0,1 0,1 1,0 1,0 0));Pose(POINT(1 1),0.5)@2001-01-01
    SELECT asText(trgeometryFromHexEWKB(asHexEWKB(trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));Pose(Point(1 1), 0.5)@2001-01-01')));
    -- POLYGON((0 0,1 0,1 1,0 1,0 0));Pose(POINT(1 1),0.5)@2001-01-01