gpt4 book ai didi

PostgreSQL (shp2pgsql) AddGeometryColumn 给出 "No function matches the given name"

转载 作者:行者123 更新时间:2023-11-29 11:57:42 27 4
gpt4 key购买 nike

我正在使用 PADUS OBI shape file ,这可能并不重要。

我正在使用默认选项通过 shp2pgsql 运行形状文件,如下所示:

shp2pgsql PADUS_1_1_CBI_Edition.shp > PADUS.sql

然后我尝试通过以下方式将 SQL 导入 Postgres:

psql -d padusdb -f PADUS.sql

出现以下错误:

psql:PADUS.sql:36: ERROR:  function addgeometrycolumn(unknown, unknown, unknown, unknown, unknown, integer) does not exist
LINE 1: SELECT AddGeometryColumn('','padus_1_1_cbi_edition','the_geo...
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

我安装了 PostGIS。

导致错误的 SQL 命令(被放入否则为空的数据库)是:

SET CLIENT_ENCODING TO UTF8;
SET STANDARD_CONFORMING_STRINGS TO ON;
BEGIN;
CREATE TABLE "padus_1_1_cbi_edition" (gid serial PRIMARY KEY,
"us_id" int4,
"category" varchar(10),
"gis_acres" numeric,
...
BUNCH OF COLUMNS, none of which is called "the_geom"
...
"comments" varchar(200),
"shape_leng" numeric,
"shape_area" numeric);
SELECT AddGeometryColumn('','padus_1_1_cbi_edition','the_geom','-1','MULTIPOLYGON',2);
COMMIT;

关于这可能意味着什么以及如何解决问题有什么想法吗?

最佳答案

因此,事实证明,仅仅在机器上安装 PostGIS 是不够的。

最初,我在 Ubuntu 10.10 上选择了 sudo apt-get install postgresql postgis。这给我留下了 PostGRE 8.4 的工作版本,但没有 PostGIS 的迹象。

因此,我尝试了 sudo apt-get install postgresql-8.4-postgis

但一个人的工作并没有就此结束!您需要设置 PostGIS 数据库。

This网站提供了有关执行此操作以及之后使用数据库的说明。

关于PostgreSQL (shp2pgsql) AddGeometryColumn 给出 "No function matches the given name",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7323857/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com