Database Reference
In-Depth Information
SELECT ST Buffer(Route, 0.6, 0:10)
FROM Delivery
The result is composed of spatiotemporal cylindroids around the trajectories
of the trucks. As we have seen in Sect.
12.2
, we can use this operation
combined with the lifted intersection topological operation for testing
whether the routes of the two trucks intersect, as follows:
SELECT ST Intersects(ST Buffer(D1.Route, 0.6, 0:10),
ST Buffer(D2.Route, 0.6, 0:10))
FROM Delivery D1, Delivery D2
WHERE D1.TruckId = T1 AND D2.TruckId = T2
Finally, the following query computes the union of two moving points:
SELECT ST Union(D1.Route, D2.Route)
FROM Delivery D1, Delivery D2
WHERE D1.TruckId = T1 AND D2.TruckId = T2
The result of the query is given next:
T MULTIPOINT(
( Point(0 0)
'
08:00
'
, Point(2 2)
'
08:10
'
, Point(2 2)
'
08:25
'
)
( Point(1 0)
'
08:05
'
, Point(3 1)
'
08:15
'
, Point(3 2)
'
08:20
'
))
For implementing temporal fields, we use temporal rasters defined by the
type
T RASTER(P,Q)
,where
P
and
Q
are defined as above. We give next an
example that combines geometries and rasters. For this, we create a table
LandPlot
describing parcels of land as follows:
CREATE TABLE LandPlot (
Id INT PRIMARY KEY,
Geom GEOMETRY(POLYGON),
SoilType RASTER,
Temp T RASTER(INSTANT,DATE) )
Here, the attribute
Geom
contains the geometry of the land plot,
SoilType
contains a raster identifying the kinds of soil in the land plot, and
Temp
contains a temporal raster reporting the temperatures in the land plot on a
daily basis. The query
SELECT L.Id, AtPeriod(L.Temp, PERIOD(
'
2012-04-01
'
,
'
2012-04-04
'
))
FROM LandPlot L
returns for each land plot a temporal raster with the temperature for each
of the 3 days in the interval. Analogously, the following query returns for
each land plot the first day at which the temperature is reported and the
nontemporal raster of that day:
SELECT L.Id, InitialInstant(L.Temp), InitialValue(L.Temp)
FROM LandPlot L
Search WWH ::
Custom Search