ST_AsTable

更新时间:2025-02-24 09:41:30

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)
  • 本页导读 (1)
  • 语法
  • 参数
  • 描述
  • 示例
AI助理

点击开启售前

在线咨询服务

你好,我是AI助理

可以解答问题、推荐解决方案等