Alex Rivera | Logout

Get the SRID of a geometry field

Asked 2012-04-03T14:15:55.807
30

I have a table with some geometry types in and need to be able to return the SRID of a given field. How can I do this. I have had a search but all I can find is the function to alter a SRID. In Oracle I am doing this:

A.CLUSTER_EXTENT.SDO_SRID 

Is there an equivalent function in PostGIS?

Edit
Report

1 Answer

-3

Figure out SRID of the data

You will notice one of the files it extracts is called TOWNS_POLY.prj. A .prj is often included with ESRI shape files and tells you the projection of the data. We'll need to match this descriptive projection to an SRID (the id field of a spatial ref record in the spatial_ref_sys table) if we ever want to reproject our data. Open up the .prj file in a text editor. You'll see something like NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001 and UNIT["Meter",1.0]

Open up your PgAdmin III query tool and type in the following statement

select srid, srtext, proj4text from spatial_ref_sys where srtext ILIKE '%Massachusetts%'

And then click the green arrow. This will bring up about 10 records. Note the srid of the closest match. In this case its 26986.

NOTE: srid is not just a PostGIS term. It is an OGC standard so you will see SRID mentioned a lot in other spatial databases, gis webservices and applications. Most of the common spatial reference systems have globally defined numbers. So 26986 always maps to NAD83_StatePlane_Massachusetts_Mainland_FIPS_2001 Meters. Most if not all MassGIS data is in this particular projection.

Source

answered 2013-03-31T08:25:11.963

Your Answer