[postgis-users] howto register an existing column intogeometry_columns

Obe, Regina robe.dnd at cityofboston.gov
Tue Aug 7 04:55:46 PDT 2007


The only guaranteed way is to add the records in geometry_columns
manually.  With a command something like
 
INSERT INTO geometry_columns(
            f_table_catalog, f_table_schema, f_table_name,
f_geometry_column, 
            coord_dimension, srid, "type")
    VALUES ('', 'public', 'sometable', 'somegeomfield', 
            2, 4326, 'MULTIPOLYGON');
 
(where replace sometable, somegeomfield, 4326, MULTIPOLYGON with your
relevant case)
 
I was going to suggest using 
 
SELECT probe_geometry_columns();
 
But that only works I think if you have constraints on those fields.  It
probably wouldn't hurt to add constraints on your geometry fields at
anyrate - of the form
 
ALTER TABLE sometable
  ADD CONSTRAINT enforce_geotype_somegeomfield CHECK
(geometrytype(somegeomfield) = 'MULTIPOLYGON'::text OR somegeomfield IS
NULL);
 
ALTER TABLE sometable  ADD CONSTRAINT enforce_srid_somegeomfield CHECK
(srid(somegeomfield) = 4326);
 
where you replace sometable and somegeomfield and the MULTIPOLYGON and
4326 with that relevant type and SRID, tablename and geometry column
name  for your table.
 
Then running 
SELECT probe_geometry_columns();
 
Would pick it up and add it.
 
Hope that helps,
Regina
 
 
 
 
 


________________________________

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Horacio Samaniego
Sent: Monday, August 06, 2007 7:17 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] howto register an existing column
intogeometry_columns


I have been trying to understand exactly how this works...

How to register an existing geometry column into geometry_columns so
that its accessible for geoprocessing.

I've unsuccessfully INSERTed the corresponding info by hand into the
geometry_columns. 

The problem is the following:
I have successfully loaded two tables that I have also successfully
INTERSECTed using the && operator. Now thise has left me with a new
table where I have 2 geometry columns. The question is how do I register
these columns to the geometry_columns table so that I can see it through
some other app like QGis? I believe that some function similar to
addgeometrycolumns() should do this... but this does not update the
geometry_column... !? 



here's an exerpt of by *new* table which I am unable to access with qgis


           Table "public.roads_in_urban_or"
       Column       |         Type          | Modifiers 
--------------------+-----------------------+-----------
 intersect_geometry | geometry              | 
 ogc_fid            | integer               | 
 wkb_geometry       | geometry              | 
.....


I apologize beforehand if this is a naive question, but it wont hurt to
document this in more depth as this is probably a very common issue...

thank, 

Horacio Samaniego





-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070807/72edcc9a/attachment.html>


More information about the postgis-users mailing list