I have setup a postgres database(version 9.1) and trying to create a table capable of storing st_geometry with the following query :
我已经设置了一个postgres数据库(版本9.1)并尝试使用以下查询创建一个能够存储st_geometry的表:
CREATE TABLE sensitive_areas (area_id integer, name varchar(128), zone st_geometry);
But I am getting the error as follows :
但我得到的错误如下:
ERROR: type "st_geometry" does not exist
Do I need to configure my postgres installation further to enable geometry data type .
我是否需要进一步配置postgres安装以启用几何数据类型。
2 个解决方案
#1
4
CREATE TABLE sensitive_areas (area_id integer, name varchar(128), zone geometry);
You should have PostGIS
installed in you db for this to work.
您应该在您的数据库中安装PostGIS以使其正常工作。
#2
11
The correct type name is geometry
. If you are you are using PostGIS 2.0 you can use a typmod:
正确的类型名称是几何。如果您使用的是PostGIS 2.0,则可以使用typmod:
-- If you haven't done so already
CREATE EXTENSION postgis;
-- Make a table of Polygons, using long/lat coords
CREATE TABLE sensitive_areas (
area_id integer primary key,
name varchar(128),
zone geometry(Polygon,4326)
);
#1
4
CREATE TABLE sensitive_areas (area_id integer, name varchar(128), zone geometry);
You should have PostGIS
installed in you db for this to work.
您应该在您的数据库中安装PostGIS以使其正常工作。
#2
11
The correct type name is geometry
. If you are you are using PostGIS 2.0 you can use a typmod:
正确的类型名称是几何。如果您使用的是PostGIS 2.0,则可以使用typmod:
-- If you haven't done so already
CREATE EXTENSION postgis;
-- Make a table of Polygons, using long/lat coords
CREATE TABLE sensitive_areas (
area_id integer primary key,
name varchar(128),
zone geometry(Polygon,4326)
);