Chapter 8. Temporal Geometry Types (Part 2)

Table of Contents

Restrictions
Spatial Reference System
Bounding Box Operations
Distance Operations
Spatial Relationships
Ever and Always Spatial Relationships
Temporal Spatial Relationships

Restrictions

  • Restrict to (the complement of) a geometry, a Z span, and/or a period

    atGeometry(tgeom,geometry[,zspan]) → tgeom

    minusGeometry(tgeom,geometry[,zspan]) → tgeom

    The geometry must be in 2D and the computation with respect to it is done in 2D. The result preserves the Z dimension of the temporal point, if it exists.

    SELECT asText(atGeometry(tgeompoint '[Point(0 0)@2001-01-01, Point(3 3)@2001-01-04)',
      geometry 'Polygon((1 1,1 2,2 2,2 1,1 1))'));
    -- {"[POINT(1 1)@2001-01-02, POINT(2 2)@2001-01-03]"}
    SELECT astext(atGeometry(tgeompoint '[Point(0 0 0)@2001-01-01, Point(4 4 4)@2001-01-05]',
      geometry 'Polygon((1 1,1 2,2 2,2 1,1 1))'));
    -- {[POINT Z (1 1 1)@2001-01-02, POINT Z (2 2 2)@2001-01-03]}
    SELECT asText(atGeometry(tgeompoint '[Point(1 1 1)@2001-01-01, Point(3 1 1)@2001-01-03,
      Point(3 1 3)@2001-01-05]', 'Polygon((2 0,2 2,2 4,4 0,2 0))', '[0,2]'));
    -- {[POINT Z (2 1 1)@2001-01-02, POINT Z (3 1 1)@2001-01-03, POINT Z (3 1 2)@2001-01-04]}
    SELECT asText(atGeometry(tgeometry 'Linestring(1 1,10 1)@2001-01-01', 
      'Polygon((0 0,0 5,5 5,5 0,0 0))'));
    -- LINESTRING(1 1,5 1)@2001-01-01
    
    SELECT asText(minusGeometry(tgeompoint '[Point(0 0)@2001-01-01, Point(3 3)@2001-01-04)',
      geometry 'Polygon((1 1,1 2,2 2,2 1,1 1))'));
    /* {[POINT(0 0)@2001-01-01, POINT(1 1)@2001-01-02), (POINT(2 2)@2001-01-03,
       POINT(3 3)@2001-01-04)} */
    SELECT astext(minusGeometry(tgeompoint '[Point(0 0 0)@2001-01-01,
      Point(4 4 4)@2001-01-05]', geometry 'Polygon((1 1,1 2,2 2,2 1,1 1))'));
    /* {[POINT Z (0 0 0)@2001-01-01, POINT Z (1 1 1)@2001-01-02),
       (POINT Z (2 2 2)@2001-01-03, POINT Z (4 4 4)@2001-01-05]} */
    SELECT asText(minusGeometry(tgeompoint '[Point(1 1 1)@2001-01-01, Point(3 1 1)@2001-01-03,
      Point(3 1 3)@2001-01-05]', 'Polygon((2 0,2 2,2 4,4 0,2 0))', '[0,2]'));
    /* {[POINT Z (1 1 1)@2001-01-01, POINT Z (2 1 1)@2001-01-02),
        (POINT Z (3 1 2)@2001-01-04, POINT Z (3 1 3)@2001-01-05]} */
    SELECT asText(minusGeometry(tgeometry 'Linestring(1 1,10 1)@2001-01-01', 
      'Polygon((0 0,0 5,5 5,5 0,0 0))'));
    -- LINESTRING(5 1,10 1)@2001-01-01
    
  • Restrict to (the complement of) an stbox

    atStbox(tgeom,stbox,borderInc bool=true) → tgeompoint

    minusStbox(tgeom,stbox,borderInc bool=true) → tgeompoint

    The third optional argument is used for multidimensional tiling (see the section called “Multidimensional Tiling”) to exclude the upper border of the tiles when a temporal value is split in multiple tiles, so that all fragments of the temporal geometry are exclusive.

    SELECT asText(atStbox(tgeompoint '[Point(0 0)@2001-01-01, Point(3 3)@2001-01-04)',
      stbox 'STBOX XT(((0,0),(2,2)),[2001-01-02, 2001-01-04])'));
    -- {[POINT(1 1)@2001-01-02, POINT(2 2)@2001-01-03]}
    SELECT asText(atStbox(tgeompoint '[Point(1 1 1)@2001-01-01, Point(3 3 3)@2001-01-03,
      Point(3 3 2)@2001-01-04, Point(3 3 7)@2001-01-09]', stbox 'STBOX Z((2,2,2),(3,3,3))'));
    /* {[POINT Z (2 2 2)@2001-01-02, POINT Z (3 3 3)@2001-01-03, POINT Z (3 3 2)@2001-01-04,
      POINT Z (3 3 3)@2001-01-05]} */
    SELECT asText(atStbox(tgeometry '[Point(1 1)@2001-01-01, Linestring(1 1,3 3)@2001-01-03,
      Point(2 2)@2001-01-04, Linestring(3 3,4 4)@2001-01-09]', stbox 'STBOX X((2,2),(3,3))'));
    -- {[LINESTRING(2 2,3 3)@2001-01-03, POINT(2 2)@2001-01-04, POINT(3 3)@2001-01-09]}
    
    SELECT asText(minusStbox(tgeompoint '[Point(1 1)@2001-01-01, Point(4 4)@2001-01-04)',
      stbox 'STBOX XT(((1,1),(2,2)),[2001-01-03,2001-01-04])'));
    -- {(POINT(2 2)@2001-01-02, POINT(3 3)@2001-01-03)}
    SELECT asText(minusStbox(tgeompoint '[Point(1 1 1)@2001-01-01, Point(3 3 3)@2001-01-03,
      Point(3 3 2)@2001-01-04, Point(3 3 7)@2001-01-09]', stbox 'STBOX Z((2,2,2),(3,3,3))'));
    /* {[POINT Z (1 1 1)@2001-01-01, POINT Z (2 2 2)@2001-01-02), 
        (POINT Z (3 3 3)@2001-01-05, POINT Z (3 3 7)@2001-01-09]} */
    SELECT asText(minusStbox(tgeometry '[Point(1 1)@2001-01-01, 
      Linestring(1 1,3 3)@2001-01-03, Point(2 2)@2001-01-04, 
      Linestring(1 1,4 4)@2001-01-09]', stbox 'STBOX X((2,2),(3,3))'));
    /* {[POINT(1 1)@2001-01-01, LINESTRING(1 1,2 2)@2001-01-03, 
       LINESTRING(1 1,2 2)@2001-01-04),[MULTILINESTRING((1 1,2 2),(3 3,4 4))@2001-01-09]} */