Sets a spatial reference identifier (SRID) on a geometry object without transforming its coordinates.
Syntax
geometry ST_SetSRID(geometry geom, integer srid);Parameters
| Parameter | Description |
|---|---|
geom | The geometry object. |
srid | The SRID to assign to the geometry object. |
Usage notes
ST_SetSRID only sets the metadata that defines the spatial reference system in which the geometry object resides. It does not reproject or transform the coordinates.
To transform a geometry object into a different projection, use ST_Transform instead.
ST_SetSRID supports circular strings and curves.
Examples
Assign SRID 4326 (WGS 84) to a line string and return the result in EWKT format:
SELECT ST_AsEWKT(ST_SetSRID(ST_GeomFromText('LINESTRING(2 1,1 1)'), 4326));Output:
st_asewkt
-------------------------------
SRID=4326;LINESTRING(2 1,1 1)
(1 row)该文章对您有帮助吗?