我正在使用以下命令使用 osm2psql
将 osm 文件导入postgres
数据库:
osm2pgsql -cGs -d osm -S /usr/local/share/osm2pgsql/default.style ~/Downloads/your_file.osm.pbf
当我在终端中运行它时,出现以下错误:
Jonathans-MacBook-Pro:Downloads rjth$ osm2pgsql -cGs -d osm -S
/usr/local/share/osm2pgsql/default.style ~/Downloads/vienna-bratislava.osm.pbf
osm2pgsql SVN version 0.84.0 (64bit id space)
Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
NOTICE: table "planet_osm_point" does not exist, skippin
NOTICE: table "planet_osm_point_tmp" does not exist, skipping
SELECT AddGeometryColumn('planet_osm_point', 'way', 900913, 'POINT', 2 );
failed: ERROR: function addgeometrycolumn(unknown, unknown, integer, unknown, integer) does not exist
LINE 1: SELECT AddGeometryColumn('planet_osm_point', 'way', 900913, ...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Error occurred, cleaning up
我已经尝试了TomH建议的类似问题,并且我已经遵循了官方瓷砖厂文档的每一步。 对于邮政的安装选项 我已经安装了postgresapp。
我遇到了同样的问题。
如果create extension postgis
已完成,则不是数据库osm
。
您需要在 osm 数据库中添加扩展。
rjth$ psql osm
osm=# create extension postgis;
然后运行您的命令以访问 osm.pbf 文件,它应该可以工作。