[postgis-devel] Re: [postgis-users] Adding SRID after the fact

strk at refractions.net strk at refractions.net
Tue Dec 14 11:22:02 PST 2004


On Tue, Dec 14, 2004 at 08:10:30PM +0100, strk at refractions.net wrote:
> On Tue, Dec 14, 2004 at 12:35:41PM -0600, David Bitner wrote:
> > Is it possible to add an SRID to a PostGIS table after the fact.  I
> > have a table that I brought in with an SRID of -1 because at the time
> > I didn't know it's SRID, but now I want to define it as 26915.
> > 
> > An update using SETSRID() results in a check constraints error.
> > 
> > Thanks
> 
> This is a pretty common issue, probably deserving a specific
> function.
> 
> You have to drop the constraint, setsrid(), put the constraint
> back and modify geometry_columns.
> 
> What people thing about a
> SELECT UpdateGeometrySrid([<schema>],<table>,<field>,<newsrid>);
> function ?

Another option would be allowing -1 as an 'unkown' SRID value, thus
passing the enforce_srid constraint.

--strk;



More information about the postgis-devel mailing list