SELECT Find_SRID('public', 'myTable', 'myColumn');
I get zero as the result, what does it mean?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
From Postgis doc:
The syntax is find_srid(, , ) and the function returns the integer SRID of the specified column by searching through the GEOMETRY_COLUMNS table. If the geometry column has not been properly added with the AddGeometryColumns() function, this function will not work either.
So you shoud have a row in GEOMETRY_COLUMNS table for F_TABLE_SCHEMA 'public', F_TABLE_NAME 'mytable' and F_GEOMETRY_COLUMN 'mycolumn' where the SRID is 0. You can update this row with the correct SRID.
Complementing with 3 "as it's":
1. As John's answer of 2014,
SRID of 0 doesn't technically exist, it just means no SRID — ie, the default if you forget to set it.
Zero is a valid SRID, your PostGIS configurations will set for some default value, that in a fresh installation will be WGS84,
2. As the "see also browsing" of docs, there are a function to update, ST_SRID(), that do the same thing:
-- OLD postgis UPDATE t SET geom.STSrid=4326 WHERE to_update; UPDATE t SET geom=ST_SetSRID(geom,4326) WHERE to_update;
There are a function specialized in updates, UpdateGeometrySRID(), and it must be used when your table declared something as
geometry(MULTILINESTRING, 4326) instead generic geometry,
3. As showed by the guide, it is a shorter way to
ALTER TABLE roads ALTER COLUMN geom TYPE geometry(MULTILINESTRING, 4326) USING ST_SetSRID(geom,4326);
(see more details at the guide)
The OGC standard say nothing about "SRID zero" or "SRID default behaviour", but it is a good practice and a PostGIS project decision. The OGC standard is expressed and can be internally accessed by the
SELECT * FROM spatial_ref_sys where srid=0 or srid=4326;
this query shows only WGS84, not the
srid=0. See more details about this standard table at Guide's "Using PostGIS / spatial_ref_sys".