OSM导入PostGreSQL数据库

0. 说在前面的话

最近在接触OSM(OpenStreemap)数据,根据介绍PostGresql的PostGis模块是众多Gis数据的数据库。 于是... ...


1. PostGresql的安装

具体的PostGresql安装就不再这里介绍了,推荐一篇文章写的很详细:http://www.v5cn.cn/?p=167

文章中介绍的软件很是有用推荐:


2. OSM数据导入PostGresql


1. 下载osm2pgsql 在第一步已经提供下载地址。

2. 最好设定一下PostGresql的环境变量,很简单的。设置jdk 一样 将 PostGresql 中的bin目录添加到PATH中

创建OSM数据库 createdb -U postgres -E UTF8 osm

添加PostGIS功能数据库psql -U postgres -d osm -f “你Postgresql安装路径\share\contrib\postgis-2.1\postgis.sql

添加epsg: 900913支持 psql -U postgres -d osm -f “本地的文件路径\900913.sql

添加hstore模式 create extension hstore;

添加OSM数据到数据库

osm2pgsql.exe -k -d osm -U postgres -S d:\maps\default.style d:\maps\map.osm

3. 期间可能会报一个错误(整了我两天郁闷死了)

使用我第一步推荐的文章一个错误: 会照成一个错误(如下) 。 使用了器推荐的create extension hstore; 依然报错

release notes: 'Windows version built by Dominik Perpeet <http://www.customdebug.com/osm2pgsql/index.html>'
Using projection SRS 900913 (Spherical Mercator)
Error reading style file line 151 (fields=4)
flag 'phstore' is invalid in non-hstore mode
Error occured,cleaning up
解决方
Hi,About phstore type,I think you can either cut those lines off 
the stylefile or use osm2pgsql in hstore more by adding -k into the 
command.


相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...