将osm文件导入postgres/postgis数据库 [英] importing osm file into a postgres/postgis database

查看:299
本文介绍了将osm文件导入postgres/postgis数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用工具osm2pgsql将osm文件导入到使用pgpgadmin作为管理工具的postgres数据库中.我只从osm以xml格式下载了一个小镇,即时通讯在Mac上使用终端导入时遇到问题.我在这方面有点菜鸟,所以任何帮助将不胜感激.我看过几篇文章,但没有一篇能满足我的需要.

Im using the tool osm2pgsql to import an osm file into a postgres database using phppgadmin as the administrative tool. i have only downloaded a small town from osm in xml format and im having trouble importing it using the terminal on mac. Im a bit of a noob at this so any help would be greatly appreciated. Ive looked at several articles but none provide the clarity i need in order to fulfill my needs.

谢谢

暂时无法获得此错误.

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,则需要执行以下操作:

You need to install the postgis extensions into your postgres database. Assuming that you have postgis installed on your machine you need to do something like:

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

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

The exact path to postgis.sql will depend on the distribution you are using and how it has packaged postgis. You may also want/need to install the spatial reference systems table with a command like this:

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

这篇关于将osm文件导入postgres/postgis数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆