1

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?

4

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;
1

Using the Find_SRID function will only return the SRID specified for this column. Only one value is defined so it returns only one row (see https://postgis.net/docs/Find_SRID.html).

If you want to get the SRID for every single geometry in your table try:

select st_srid(yourgeom) from yourtable;

or to get all the used srids only once:

select distinct st_srid(yourgeom) from yourtable;

But I think if you defined some SRID for your geometry column, PostGIS will only accept geometries with this SRID. So the last query will only return one SRID value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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