[GIS] Get different SRIDs of geometry column in a table

postgissrid

It is possible that a geometry column in a table of PostGIS has different SRIDs. I've used Find_SRID to get the SRID of this column but seems it only returns one value for SRID which is the first row. What is the reason?

Best Answer

If column in your table has explicitly defined geometry type and srid, like:

CREATE TABLE geom_table (id serial, geom geometry(point,3857);

Your database will not allow to place there any other geometries than point in srid 3857... but you can also define table like this:

CREATE TABLE geom_table (id serial, geom geometry);

Than you can store there different geometries in different srids. You can use ST_GeometryType and ST_SRID to find out what is in this column:

SELECT DISTINCT ST_SRID(geom) FROM table;

SELECT DISTINCT ST_GeometryType(geom) FROM table;