All Products
Search
Document Center

PolarDB:ST_SetSRID

Last Updated:Mar 28, 2026

Sets the spatial reference identifier (SRID) of a trajectory object.

Syntax

trajectory ST_SetSRID(trajectory traj, int srid)

Parameters

ParameterDescription
trajThe trajectory whose SRID you want to set.
sridThe SRID to assign to the trajectory.

Description

ST_SetSRID assigns the specified SRID to a trajectory. It updates only the SRID metadata — coordinates and all other trajectory fields remain unchanged.

Example

Change the SRID of a trajectory from 4326 to 4002:

SELECT ST_SetSRID(
  '{"trajectory":{"version":1,"type":"STPOINT","leafcount":2,"start_time":"2007-05-27 00:00:00","end_time":"2007-05-28 08:36:47.846","spatial":"SRID=4326;LINESTRING(13.43593 52.41721,13.43593 52.41721)","timeline":["2007-05-27 00:00:00","2007-05-28 08:36:47.846"]}}'::trajectory,
  4002
);

Output:

{"trajectory":{"version":1,"type":"STPOINT","leafcount":2,"start_time":"2007-05-27 00:00:00","end_time":"2007-05-28 08:36:48","spatial":"SRID=4002;LINESTRING(13.43593 52.41721,13.43593 52.41721)","timeline":["2007-05-27 00:00:00","2007-05-28 08:36:48"]}}
(1 row)

The output trajectory is identical to the input except that "SRID=4326" in the spatial field is now "SRID=4002". Coordinates are unchanged.