PostGIS: register a "geometry" column without AddGeometryColumn

wildpeaks picture wildpeaks · Oct 22, 2010 · Viewed 7.4k times · Source

The usual way to create a geometry column is AddGeometryColumn, however I have to work with pre-existing columns, so I can't use that function (as far as I know).

Thanks to the PostGIS docs, I can already register the column in the "geometry_columns" table, however AddGeometryColumn seems to do more than create a column and add a row in geometry_columns, for example it adds checks on the column.


So my question is what: what do I need to do to register the column manually, besides adding a row in *geometry_columns* ?

(for example, is there a modified version AddGeometryColumn that works with an existing column ?)

Answer

Nicklas Avén picture Nicklas Avén · Oct 22, 2010

The easiest way of doing it on existing columns is using the function Populate_Geometry_Columns:
http://postgis.org/documentation/manual-1.5/Populate_Geometry_Columns.html

In other words: The function you are asking for is already there :-)

HTH Nicklas