[postgis-users] Table w/existing geometry column (without AddGeometryColumn), SRID?

Kevin Neufeld kneufeld at refractions.net
Thu Oct 23 16:12:04 PDT 2008


Stefan Keller wrote:
> * Does any postgis-function or spatial index fail when there is no
> entry in geometry_columns table (except of course where explicit
> coordinate transformation is needed)?
> 

As far as I'm aware, there aren't any functions in PostGIS that actually 
use the values stores in the geometry_columns table.  This includes 
coordinate transformation.

ie. SELECT ST_Transform('SRID=3005;POINT(940245 567728)', 4326);
This can be done on the fly ... the point doesn't have to be in a table 
that's registered with geometry_columns.

The geometry_columns table really only exists to be compliant with the 
OpenGIS Simple Features Specification for SQL so that external programs, 
like Mapserver, can use the table instead of hunting through the system 
tables to find tables with geometry columns.

> * The value -1 is used to indicate no specified SRID. Does it make a
> difference, if the SRID default is '0' instead of '-1' ?

Nope, but you can't change the SRID default in PostGIS.  Right now, it's 
hard coded in many functions (ie. the WKT parser) and external programs 
(ie. pgsql2shp) to use -1.

SELECT GetSRID('POINT(0 0)'::geometry);
  getsrid
---------
       -1
(1 row)

However, there's nothing stopping you from setting the SRID = 0 on all 
your geometries.  Interestingly, I believe the SQL/MM standard now uses 
0 as the default instead of -1.

> * Given all data is stored with SRID set to 0, is it still possible to
> use all spatial functions (similar to "SELECT ... USING SRID=-1")?
> 
> -- Stefan
> 

I'm not sure I understand.  As long as the SRIDs are the same for 
operations on pairs of geometries, PostGIS doesn't care what the SRID is 
(-1, 0, 3005, a custom SRID, ...)

Hope this helps,
Cheers,
Kevin.



More information about the postgis-users mailing list