微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

postgresql – osm2pgsql:函数AddGeometryColumn不存在

我想使用工具 Osm2pgsqlOSM file导入Postgresql数据库(Windows,Postgres版本9.2).

当我运行以下命令

osm2pgsql.exe --create -d mydb artyom.xml -U myuser -W --style default.style

我得到错误

SELECT AddGeometryColumn('planet_osm_point','way',900913,'POINT',2 );
 Failed: FEHLER:  Funktion addgeometrycolumn(unkNown,unkNown,integer,integer) existiert nicht
LINE 1: SELECT AddGeometryColumn('planet_osm_point',...
               ^
HINT:  Keine Funktion stimmt mit dem angegebenen Namen und den Argumenttypen ├╝b
erein. Sie m├╝ssen m├Âglicherweise ausdr├╝ckliche Typumwandlungen hinzuf├╝gen.

Error occurred,cleaning up

德文翻译:

SELECT AddGeometryColumn('planet_osm_point',2 );
 Failed: ERROR:  Function addgeometrycolumn(unkNown,integer) doesn't exist
LINE 1: SELECT AddGeometryColumn('planet_osm_point',...
               ^
HINT: No function matches the specified name and argument types. Maybe you need
to make explicit casts.

Error occurred,cleaning up

如何解决这个问题?

看起来您尚未将PostGIS支持添加到您尝试使用osm2pgsql.exe的数据库中.见 the PostGIS installation documentation (2.0).

由于您使用的是PostGIS 2.0,所以您应该只能创建EXTENSION postgis;加载PostGIS.此命令必须作为超级用户运行 – 通常是用户postgres.使用:

psql -U postgres mydbname

用户postgres连接.

看来,至少osm2pgsql的Windows版本不支持PostGIS 2.0 – 或者大约六个月前还没有支持.请参阅OSG GitHub上的this issue reportinstructions on how to set a PostGIS 2 database to be compatible with an osm2pgsql that expects PostGIS 1.x.未来的读者应该检查在继续操作之前仍然需要执行这些步骤; Windows的osm2pgsql可能会在某些时候被更新,以支持PostGIS 2.

原文地址:https://www.jb51.cc/postgresql/192626.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐