The topological and distance relationships described in the section called “Spatial Relationships” such as eIntersects
, aDwithin
, or tContains
are defined over the geographical space while the temporal network points are defined over the network space. To be able to apply these relationships to the temporal network points, they must be transformed to temporal geometry points. This can be easily performed using the functions geometry
and tgeompoint
or using an explicit casting ::
as shown in the examples below.
Ever and always spatial relationships
SELECT eContains(geometry 'SRID=5676;Polygon((0 0,0 50,50 50,50 0,0 0))', tgeompoint(tnpoint '[NPoint(1, 0.1)@2001-01-01, NPoint(1, 0.3)@2001-01-03)')); -- false SELECT eDisjoint(geometry(npoint 'NPoint(2, 0.0)'), tgeompoint(tnpoint '[NPoint(1, 0.1)@2001-01-01, NPoint(1, 0.3)@2001-01-03)')); -- true SELECT eIntersects( tnpoint '[NPoint(1, 0.1)@2001-01-01, NPoint(1, 0.3)@2001-01-03)'::tgeompoint, tnpoint '[NPoint(2, 0.0)@2001-01-01, NPoint(2, 1)@2001-01-03)'::tgeompoint); -- false
SELECT tContains(geometry 'SRID=5676;Polygon((0 0,0 50,50 50,50 0,0 0))', tgeompoint(tnpoint '[NPoint(1, 0.1)@2001-01-01, NPoint(1, 0.3)@2001-01-03)')); -- [f@2001-01-01 00:00:00+01, f@2001-01-03 00:00:00+01) SELECT tDisjoint(geometry(npoint 'NPoint(2, 0.0)'), tgeompoint(tnpoint '[NPoint(1, 0.1)@2001-01-01, NPoint(1, 0.3)@2001-01-03)')); -- [t@2001-01-01 00:00:00+01, t@2001-01-03 00:00:00+01) SELECT tDwithin( tnpoint '[NPoint(1, 0.3)@2001-01-01, NPoint(1, 0.5)@2001-01-03)'::tgeompoint, tnpoint '[NPoint(1, 0.5)@2001-01-01, NPoint(1, 0.3)@2001-01-03)'::tgeompoint, 1); /* {[t@2001-01-01 00:00:00+01, t@2001-01-01 22:35:55.379053+01], (f@2001-01-01 22:35:55.379053+01, t@2001-01-02 01:24:04.620946+01, t@2001-01-03 00:00:00+01)} */