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

Kevin Neufeld kneufeld at refractions.net
Thu Oct 23 08:55:25 PDT 2008


Did you try probe_geometry_columns()?

It scans the system tables looking for the constraints usually assigned 
to a geometry column and inserts the discovery into the 
public.geometry_columns table.

Alternatively, you can use the attached plpgsql that I use all the time.

Using the provided table oid, it tries to determine the srid, dimension, 
and geometry type of the geometry columns in the table, adds the 
constraints to the table the column belongs in, and further populates 
public.geometry_columns accordingly.  This is useful if the constraints 
don't already exists on a spatial column.

SELECT populate_geometry_columns('public.mytable'::regclass);

Cheers,
Kevin

Kristian Thy wrote:
> On Thu, Oct 23, Stefan Keller wrote:
>> * Is there a trick to add metadata to the "geometry_columns" table,
>> given a table already exists with one geometry column?
> 
> It is trivial to insert it manually, but I would like to add my vote for
> a RegisterGeometryColumn(...) function for easing the process.
> 
> \\kristian
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: populate_geometry_columns.sql
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081023/1236faa9/attachment.ksh>


More information about the postgis-users mailing list