ST_SetStorageLocation

设置一个新的轨迹数据外部存储位置。

语法

trajectory ST_SetStorageLocation(trajectory traj, text new_path, bool checkValid default true);

参数

参数名称

描述

traj

轨迹对象。

new_path

外部存储字符串,目前仅支持OSS文件夹,格式为:'OSS://<access key>:<access secret>@<endpoint>/<bucket>/<directory>',轨迹文件将存储在对应文件夹下的.gtf文件中。

checkvalid

是否需要验证正确性,默认为true。如果为true,则尝试用新设定的AccessKey访问OSS,如果访问失败则报错。

描述

更改轨迹外部存储的位置。本函数不会移动原有的外部存储文件,如需使用,需要首先在OSS中移动存储了轨迹外部数据的文件夹,再通过此函数将轨迹重新指向新的存储位置。

移动外部文件后,可能出现向文件插入轨迹时,无法插入并报错某文件出现is not appendable的情况。请确保最后一个分块通过OSSAppend方式上传。

示例

select ST_SetStorageLocation(traj, '<New Path>') from trajs;
                                                                                                                                                                                                                                         st_setstoragelocation                                                                                                                                                                                                                                          
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 {"trajectory":{"version":1,"type":"STPOINT","leafcount":6,"start_time":"Sat Jan 01 03:15:42 2000","end_time":"Sat Jan 01 05:16:43 2000","spatial":"LINESTRING(2 2 0,33.042158099636 36.832684322819 0,47.244002354518 47.230026333034 0,64.978971942887 60.618813472986 0,77.621717839502 78.012496630661 0,80 78 0)","timeline":["Sat Jan 01 03:15:42 2000","Sat Jan 01 03:39:54 2000","Sat Jan 01 04:04:06 2000","Sat Jan 01 04:28:18 2000","Sat Jan 01 04:52:31 2000","Sat Jan 01 05:16:43 2000"]}}
 {"trajectory":{"version":1,"type":"STPOINT","leafcount":6,"start_time":"Sat Jan 01 03:15:42 2000","end_time":"Sat Jan 01 05:16:43 2000","spatial":"LINESTRING(2 2 0,33.042158099636 36.832684322819 0,47.244002354518 47.230026333034 0,64.978971942887 60.618813472986 0,77.621717839502 78.012496630661 0,80 78 0)","timeline":["Sat Jan 01 03:15:42 2000","Sat Jan 01 03:39:54 2000","Sat Jan 01 04:04:06 2000","Sat Jan 01 04:28:18 2000","Sat Jan 01 04:52:31 2000","Sat Jan 01 05:16:43 2000"]}}
 {"trajectory":{"version":1,"type":"STPOINT","leafcount":6,"start_time":"Sat Jan 01 03:15:42 2000","end_time":"Sat Jan 01 05:16:43 2000","spatial":"LINESTRING(2 2,33.042158099636 36.832684322819,47.244002354518 47.230026333034,64.978971942887 60.618813472986,77.621717839502 78.012496630661,80 78)","timeline":["Sat Jan 01 03:15:42 2000","Sat Jan 01 03:39:54 2000","Sat Jan 01 04:04:06 2000","Sat Jan 01 04:28:18 2000","Sat Jan 01 04:52:31 2000","Sat Jan 01 05:16:43 2000"]}}
 TRAJECTORY EMPTY
(4 rows)