Capítulo 8. Tipos temporales geométricos (Parte 2)

Tabla de contenidos

Restricciones
Sistema de referencia espacial
Operaciones de cuadro delimitador
Operaciones de distancia
Relaciones espaciales
Relaciones alguna vez o siempre
Relaciones espaciotemporales

Restricciones

  • Restringir a (al complemento de) una geometría

    atGeometry(tgeom,geometry) → tgeom

    minusGeometry(tgeom,geometry]) → tgeom

    La geometría debe ser 2D y el cálculo con respecto a ella se realiza en 2D. El resultado conserva la dimensión Z del punto temporal, si existe.

    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))'));
    -- {[POINT Z (2 1 1)@2001-01-02, POINT Z (3 1 1)@2001-01-03, POINT Z (3 1 3)@2001-01-05]}
    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))'));
    -- {[POINT Z (1 1 1)@2001-01-01, POINT Z (2 1 1)@2001-01-02)}
    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
    
  • Restringir a (al complemento de) un stbox

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

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

    El tercer argumento opcional se utiliza para mosaicos multidimensionales (ver “Mosaicos multidimensionales”) para excluir el borde superior de los mosaicos cuando un valor temporal se divide en varios mosaicos, de modo que todos los fragmentos de la geometría temporal sean exclusivos.

    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]} */
    
  • Restringir a (al complemento de) un rango de altitud

    atElevation(tgeom,zspan) → tgeom

    minusElevation(tgeom,zspan) → tgeom

    SELECT astext(atElevation(tgeompoint '[Point(1 1 1)@2001-01-01,
      Point(4 4 4)@2001-01-04, Point(1 1 1)@2001-01-07]', floatspan '[2,3]'));
    /* {[POINT Z (2 2 2)@2001-01-02, POINT Z (3 3 3)@2001-01-03],
      [POINT Z (3 3 3)@2001-01-05, POINT Z (2 2 2)@2001-01-06]} */
    SELECT astext(minusElevation(tgeompoint '[Point(1 1 1)@2001-01-01,
      Point(4 4 4)@2001-01-04, Point(1 1 1)@2001-01-07]', floatspan '[2,3]'));
    /* {[POINT Z (2 2 2)@2001-01-02, POINT Z (3 3 3)@2001-01-03],
      [POINT Z (3 3 3)@2001-01-05, POINT Z (2 2 2)@2001-01-06]} */