[postgis-devel] Unknown SRID <= 0 status report

Sandro Santilli strk at keybit.net
Mon Oct 10 00:58:05 PDT 2011


This mail to summarize the current state of code after
taking SRID <= 0 as unknown.

Serializer and deserializer have been changed to clamp
the SRID so to fall in the valid range: 1..999999.

Such clamping will return an ERROR if a SRID > 999999
is encountered (this was already the case before the change),
and it will return a NOTICE if a SRID < 1 is passed which is
not the _official_ SRID_UNKNOWN value.  Here's an example:

 =# select st_srid(st_setsrid('POINT(0 0)'::geometry, -1));
 NOTICE:  SRID value -1 converted to the officially unknown SRID value 0
  st_srid
 ---------
        0

Having the NOTICE will help figuring out how many occurrences of
explicit "unknown" SRID values are in use out there. Our own testsuite
had a few such occurrences, fixed by omitting the SRID parameter when
possible or hushing the NOTICE otherwise. Here's a list of such fixes:

 http://trac.osgeo.org/postgis/changeset/7962 (raster)
 http://trac.osgeo.org/postgis/changeset/7961 (core/tickes.sql)
 http://trac.osgeo.org/postgis/changeset/7953 (geography)
 http://trac.osgeo.org/postgis/changeset/7952 (core/relate.sql)

Using invalid SRID values at the LWGEOM level is still possible, except
when costructing objects via WKB/WKT parsing, which does the clamping.

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html



More information about the postgis-devel mailing list