postgresql 如何使用 pgAdmin 添加几何列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35384346/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to add geometry column using pgAdmin
提问by Alessandro Carrese
I'm using a database created in the PostgreSQL. In its schema there are two tables and in one of them I want to add a geometry
column.
我正在使用在 PostgreSQL 中创建的数据库。在它的架构中有两个表,我想在其中一个表中添加一geometry
列。
The problem is that I created the postgis Extension (CREATE EXTENSION postgis;
) for the database, but I'm not able to add this data type (geometry) column using pgAdmin.
问题是我CREATE EXTENSION postgis;
为数据库创建了 postgis 扩展 ( ),但我无法使用 pgAdmin 添加此数据类型(几何)列。
回答by Mike T
To do this with pgAdmin's "New Column..." dialog, if you can't find geometry
, then you might be able to find public.geometry
instead (if PostGIS was installed there, which is normal).
要使用 pgAdmin 的“新列...”对话框执行此操作,如果您找不到geometry
,那么您可能可以找到public.geometry
(如果 PostGIS 安装在那里,这是正常的)。
However, I advise against using pgAdmin for creating geometry columns, as it does not understand typmods used to define the geometry type and SRID.
但是,我建议不要使用 pgAdmin 创建几何列,因为它不理解用于定义几何类型和 SRID 的 typmods。
The best way is using DDLto directly manipulate the table, e.g.:
最好的方法是使用DDL直接操作表,例如:
ALTER TABLE locations ADD COLUMN geom geometry(PointZ,4326);
to add a geom
column of XYZ points (long, lat, alt).
添加一geom
列 XYZ 点(long、lat、alt)。