[postgis-devel] probe_geometry_columns

Kevin Neufeld kneufeld at refractions.net
Tue Apr 11 09:58:09 PDT 2006

Hello all,

I've created a more robust version of the probe_geometry_columns 
function. Often, during development, many spatial tables are formed and 
more often than not, developers can't be bothered to religiously use the 
add/dropgeometrycolumn methods when creating or dropping tables. 
Unfortunately, the probe_geometry_columns does not deal with these 
spatial columns (ie. CREATE TABLE mytbl (LIKE somespatialtable) .... or 
CREATE TABLE mytbl AS SELECT * FROM somespatialtable...)

This version of probe_geometry_columns (that I've temporarily dubbed 
populate_geometry_columns) will
   1. truncate geometry_columns
   2. using the system tables, insert all spatial columns to 
geometry_columns where spatial constraints exists
   3. probe remaining columns for srid, ndims, and geotype, apply 
necessary table constraints, and insert the spatial column into 
   4. gracefully throw a warning if the srid/ndims/geotype values could 
not be determined (ie. empty table or null geometries)

Let me know if you think this might be useful.


Kevin Neufeld,
Refractions Research Inc.,
kneufeld at refractions.net
Phone: (250) 383-3022 
Fax:   (250) 383-2140 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: populate_geometry_columns.sql
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20060411/c2a3a55d/attachment.ksh>

More information about the postgis-devel mailing list