ArcGIS Server Banner

ST_SRID

ST_SRID

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback

Definition

ST_SRID takes a geometry object and returns its spatial reference ID.

Syntax

Oracle

sde.st_srid(g1 st_geometry)

PostgreSQL

st_srid (g1 st_geometry)

Return type

Integer

Example

The following table is created:

Oracle

CREATE TABLE srid_test (g1 sde.st_geometry);

PostgreSQL

CREATE TABLE srid_test (g1 st_geometry);

In the next statement, an ST_Point geometry located at coordinate (10.01, 50.76) is inserted into the geometry column g1. When the ST_Point geometry was created by the ST_PointFromText function (Oracle) or ST_Point function (PostgreSQL), it was assigned the SRID value of 0.

NOTE: If you want to use an actual SRID value, either use one of your existing SRIDs and alter the coordinates to fit, or insert the spatial references given at the end of this example and run this example with the SRID you assign for it.

Oracle

INSERT INTO srid_test VALUES (
sde.st_pointfromtext ('point (10.01 50.76)', 0)
);

PostgreSQL

INSERT INTO srid_test VALUES (
st_point ('point (10.01 50.76)', 0)
);

The ST_SRID function returns the spatial reference ID of the geometry just entered.

Oracle

SELECT sde.st_srid (g1) SRID_G1
FROM srid_test;

SRID_G1

         0

PostgreSQL

SELECT st_srid (g1) AS SRID_G1
FROM srid_test;

srid_g1

         0

Inserting a spatial reference system

Execute the following command to insert the necessary spatial reference system to your table, changing the SRID to the next available number in your table.

Oracle

INSERT INTO SDE.ST_SPATIAL_REFERENCES VALUES (
   'GCS_North_American_1983', 
   {1 | <next srid>}, 
   -400, 
   -400, 
   1000000000, 
   -100000, 
   10000, 
   -100000, 
   10000, 
   9.999E35, 
   -9.999E35, 
   9.999E35, 
   -9.999E35, 
   9.999E35, 
   -9.999E35, 
   9.999E35, 
   -9.999E35, 
   4269, 
   'GCS_North_American_1983', 
   'PROJECTED', 
   NULL,
   NULL,
'GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]',
   'ArcSDE SpRef'
   );

PostgreSQL

INSERT INTO st_spatial_references VALUES (
   'GCS_North_American_1983', 
   {1 | <next srid>}, 
   -400, 
   -400, 
   1000000000, 
   -100000, 
   10000, 
   -100000, 
   10000, 
   9.999E35, 
   -9.999E35, 
   9.999E35, 
   -9.999E35, 
   9.999E35, 
   -9.999E35, 
   9.999E35, 
   -9.999E35, 
   4269, 
   'GCS_North_American_1983', 
   'PROJECTED', 
   NULL,
   NULL,
'GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]',
   'ArcSDE SpRef'
   );

See Also

  • An overview of SQL functions used with ST_Geometry types