8

我使用工具 osm2pgsql 将 osm 文件导入使用 phppgadmin 作为管理工具的 postgres 数据库。我只从 osm 以 xml 格式下载了一个小镇,我无法使用 mac 上的终端导入它。我对此有点菜鸟,所以任何帮助将不胜感激。我看过几篇文章,但没有一篇文章能提供我需要的清晰度以满足我的需求。

谢谢

我得到这个错误可能是一些小的不确定..

Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
NOTICE:  table "planet_osm_point" does not exist, skipping
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.
4

2 回答 2

7

您需要将 postgis 扩展安装到您的 postgres 数据库中。假设您的机器上安装了 postgis,您需要执行以下操作:

psql <database> < /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql

确切的路径postgis.sql取决于您使用的发行版以及它如何打包 postgis。您可能还希望/需要使用如下命令安装空间参考系统表:

psql <database> < /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
于 2011-07-01T10:49:26.697 回答
0

这是一个示例命令:

osm2pgsql -c -d your_country -U postgres -W -H localhost -P 5432 -s -k -x -p osm -S default.style ..\your_country.osm.bz2

以下是一些有用的网络链接: http://wiki.openstreetmap.org/wiki/Osm2pgsql http://www.gis.hsr.ch/wiki/Osm2pgsql

-S。

于 2012-04-19T23:19:25.693 回答