///
Considere a seguinte estrutura de dados criada em SGBD PostgreSQL com extensão espacial PostGIS:
| Atributo | Tipo | Significado |
|---|---|---|
| taxi | bigint | Identificador associado ao taxi rastreado |
| t | Timestamp | Quantidade de segundos |
| geom | Point | Geometria referente à posição rastreada. (EPSG 4326) |
Foi elaborado o seguinte código para ser executado na estrutura definida.
1 create index taxi_idx
2 select distinct taxi,
3 extract(day from t) as dia,
4 max(t) over p as chegada,
5 min(t) over p as partida
6 from taxi
7 particao p as (partition by taxi, extract(day from
t))
8 select taxi,
9 t,
10 lead(t) over (partition by taxi order by
t) - t as time_gap,
11 st_distance(lead(geom) over (partition by
taxi order by t), geom) as space_gap,
12 geom
13 from taxiDe acordo com o código supracitado, o atributo time_gap é do tipo