ST_SRID

Definition

ST_SRID takes an ST_Geometry object and returns its spatial reference ID.

Syntax

sde.st_srid (g1 sde.st_geometry)

Return type

Integer

Examples

The following table is created:

CREATE TABLE srid_test (g1 sde.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.

注意注意:

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 (
sde.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 sde.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'
   );

3/7/2012