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安装路径sharecontribpostgis-2.1postgis.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:mapsdefault.style d:mapsmap.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.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |