將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)