Sets the spatial reference identifier (SRID) on a geometry object. Useful for marking a geometry with the coordinate system it uses before querying or transforming it.
Syntax
geometry ST_SetSRID(geometry geom, integer srid);Parameters
| Parameter | Description |
|---|---|
geom | The geometry object. |
srid | The SRID of the geometry object. |
Usage notes
ST_SetSRID sets the metadata that defines the spatial reference system in which the geometry object resides. It does not transform the coordinates of the geometry object.
NoteTo transform a geometry object into a different projection, use
ST_Transforminstead.ST_SetSRID supports circular strings and curves.
Examples
Example 1: Mark a line as WGS 84 (SRID 4326)
-- Mark a LINESTRING as WGS 84 (long/lat)
SELECT ST_AsEWKT(ST_SetSRID(ST_GeomFromText('LINESTRING(2 1,1 1)'), 4326));Result:
st_asewkt
-------------------------------
SRID=4326;LINESTRING(2 1,1 1)
(1 row)See also
ST_SRID— Get the SRID of a geometry objectST_Transform— Transform a geometry object into a different spatial reference systemUpdateGeometrySRID— Update the SRID of all geometry objects in a table column
该文章对您有帮助吗?