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

发布于 2024-11-18 04:25:34 字数 810 浏览 10 评论 0原文

我使用 osm2pgsql 工具将 osm 文件导入到 postgres 数据库中,并使用 phppgadmin 作为管理工具。我只从 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.

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.

Thanks

im getting this error could be something small not sure..

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

月朦胧 2024-11-25 04:25:34

您需要将 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

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

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
一念一轮回 2024-11-25 04:25:34

这是一个示例命令:

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。

This is an example command:

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

Here are some useful weblinks:
http://wiki.openstreetmap.org/wiki/Osm2pgsql
http://www.gis.hsr.ch/wiki/Osm2pgsql

-S.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文