Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

what is the function for getting SRID from Geometry field. I have inserted a shapefile into SQLServer table with Geometry field defined. I know the projection of shapefile is Swreff99_1800 (EPSG:3011). Now my question is How I get this SRID 3011 by using some OGC method of geometry field?

share|improve this question
    
I'm not clear as to what you are needing. Do you need the definition of the SRID 3011 from SQL Server? It sounds like you have already inserted the data with the proper SRID set, yes? –  Chad Cooper Feb 7 '12 at 12:54

2 Answers 2

up vote 9 down vote accepted

Is this what you are looking for?

select distinct SP_GEOMETRY.STSrid from dbo.MYTABLE

This will give you a table with the different SRID's used in the table dbo.MYTABLE

share|improve this answer
    
Thanks!. My second question is SRID 3011 is not defined in sys.spatial_reference_systems table. And i need to transform the geometry from SRID 3011 to SRID 4326. What I do then ? –  user1899 Feb 7 '12 at 13:41
1  
As far as I know, SQL Server 2008 is not able to transform your geometry data bewteen different coordinate systems - it sees all geometry data as stored in a mathematical coordinate system. –  Peter Horsbøll Møller Mar 19 '12 at 20:10

After trying the above with no luck, I tried the method below:

select [geomColumnName].STSrid
from [schema].[tableName]

This gives the SRID value for all records in the table. I would assume that since all records SHOULD have the same SRID, that if you wanted to simply get the value for one record it would tell you the SRID for the entire table:

select top 1 [geomColumnName].STSrid
from [schema].[tableName]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.