[postgis-users] Do I always have to use AddGeometryColumn?

Frank Koormann frank.koormann at intevation.de
Wed May 24 11:19:15 PDT 2006


* Galen Ward <galen at shackprices.com> [060524 19:17]:
> 
> Sort of a newbie question here: The PostGis manual
> (http://www.postgis.org/docs/ch03.html#id2917099) seems to indicate that I
> always have to use the AddGeometryColumn function to properly create
> metadata and spatial fields, but that makes it difficult to backup and move
> databases.  Will the same tables be created from a dump? 

If you are dumping / restoring full databases - yes. If you are only
dumping / restoring the single table containing the geometries you have
to consider the geometry_columns table explicitely.


>  I.E. can I use
> this to create a table:
> 
> 	...
> 	  the_geom geometry,
> 	  CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
> 	  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom)
> = 	'POINT'::text OR the_geom IS NULL),
> 	  CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 4269
> 	...
> 
> Instead of this:
> 
> 	AddGeometryColumn(...)?

Yes, you can use the above. However in that case  no record inthe
geometry_columns table is created with  the metadata. That is no problem
for PostGIS, but some client applications may rely on this OGC SF
structures.

HTH,

        Frank

-- 
Frank Koormann                             <frank.koormann at intevation.de>
 Professional Service around Free Software       (http://intevation.net/)
 FreeGIS Project                                 (http://freegis.org/)



More information about the postgis-users mailing list