You can use this function to change the location of the Object Storage Service (OSS) file that stores the data of a trajectory object.


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


Parameter Description
traj The trajectory object.
new_path The string that specifies the folder in which you want to store the data of the specified trajectory object. Only folders in OSS are supported. The format of the parameter value is 'OSS://<AccessKey ID>:< AccessKey secret>@<Endpoint>/<Bucket>/<Directory>'. The data of the specified trajectory object is stored in a .gtf file in the specified folder.
checkvalid Specifies whether to check the validity of the path. Default value: true. If this parameter is set to true, the system tests whether the specified OSS directory can be accessed by using your AccessKey pair. If the access test fails, an error is returned.


This function changes the location of the file that stores the data of a specified trajectory object. This function does not move the original file that stores the data of the trajectory object. Before you use this function to specify a new location, you first need to move the folder that contains the trajectory data file in OSS to the new location.

After the file is moved to the new location, new trajectory data may not be appended to the file. In this case, an error message that contains is not appendable is returned. Make sure that the last data block is uploaded by calling the AppendObject operation of OSS.


select ST_SetStorageLocation(traj, '<New Path>') from trajs;
(4 rows)