将 osm 文件导入 postgres/postgis 数据库

2024-02-24

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

Thanks

我收到此错误可能是一些小错误,不确定..

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.

您需要将 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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将 osm 文件导入 postgres/postgis 数据库 的相关文章

随机推荐