PostGIS:注册“几何图形”没有 AddGeometryColumn 的列
创建几何列的常用方法是 AddGeometryColumn,但是我必须使用预先存在的列,因此我无法使用该函数(据我所知)。
感谢 PostGIS 文档,我已经可以在“ Geometry_columns”表,但是AddGeometryColumn似乎不仅仅创建列和在geometry_columns中添加行,例如它添加检查列。
所以我的问题是:除了在 geometry_columns 中添加一行之外,我还需要做什么来手动注册列?
(例如,是否有可与现有列配合使用的修改版本AddGeometryColumn?)
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 ?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在现有列上执行此操作的最简单方法是使用函数 Populate_Geometry_Columns:
https://postgis.net/docs/Populate_Geometry_Columns.html
换句话说:您的函数所要求的已经存在:-)
HTH
尼克拉斯
The easiest way of doing it on existing columns is using the function Populate_Geometry_Columns:
https://postgis.net/docs/Populate_Geometry_Columns.html
In other words: The function you are asking for is already there :-)
HTH
Nicklas
正如您所说,
AddGeometryColumn
只是一个方便的快捷方式,不仅可以创建列,还可以添加类型检查和索引。当然,您可以手动将它们添加到现有列中:您只需在单个命令中执行与AddGeometryColumn
相同的操作即可。如果您需要将一个“常规”列传输到“gis”列,为什么不使用 SELECT INTO 来传输数据呢?
As you said,
AddGeometryColumn
is only a handy shortcut for creating not only the column, but adding type checks and indexes. Of course, you can add these by hand to an existing column: you simply need to do the same things that theAddGeometryColumn
does for you in a single command.If you need to transfer one "regular" column to a "gis" column, why not use
SELECT INTO
for transfering the data?