將trajectory對象輸出為資料庫中的表格。
文法
trajectory ST_AsTable (trajectory traj);
參數
參數名稱 | 描述 |
traj | 原始軌跡。 |
描述
將軌跡轉換為表格的形式進行輸出,表格的形式和ST_makeTrajectory的文法5一致。
樣本
-- 輸出元組
With traj AS (
select '{"trajectory":{"version":1,"type":"STPOINT","leafcount":2,"start_time":"2010-01-01 11:30:00","end_time":"2010-01-01 12:30:00","spatial":"SRID=4326;LINESTRING(1 1,3 5)","timeline":["2010-01-01 11:30:00","2010-01-01 12:30:00"]}}'::trajectory a
)
select ST_AsTable(a) from traj;
st_astable
-----------------------------
("2010-01-01 11:30:00",1,1)
("2010-01-01 12:30:00",3,5)
(2 rows)
-- 輸出表格
select * from ST_AsTable('{"trajectory":{"version":1,"type":"STPOINT","leafcount":2,"start_time":"2010-01-01 11:30:00","end_time":"2010-01-01 12:30:00","spatial":"SRID=4326;LINESTRING(1 1,3 5)","timeline":["2010-01-01 11:30:00","2010-01-01 12:30:00"]}}'::trajectory) as f(t timestamp,x double precision, y double precision);
t | x | y
---------------------+---+---
2010-01-01 11:30:00 | 1 | 1
2010-01-01 12:30:00 | 3 | 5
(2 rows)