OSM导入PostGreSQL数据库
2014-04-15 11:12
1261 查看
0. 说在前面的话 最近在接触OSM(OpenStreeMap)数据,根据介绍PostGreSQL的PostGis模块是众多Gis数据的默认数据库。 于是... ... 1. PostGreSQL的安装 具体的PostGreSQL安装就不再这里介绍了,推荐一篇文章写的很详细:http://www.v5cn.cn/?p=167 文章中介绍的软件很是有用推荐:Postgresql——Postgresql是一种对象关系型数据库。本文我们使用9.3.1版本。下载地址:http://www.postgresql.org/download/osm2pgsql——是由OpenStreetMap开发的一个命令行工具负责将OSM数据导入到基于PostgresSql的Postgis的数据库中,这样GeoServer才能调用数据发布服务器。下载地址:http://customdebug.com/osm/osm2pgsql.zip,其次我们还要指定osm2pgsql的gitHub地址因为我们需要的两个文件在里面可以找到一个是900913.sql一个是default.style,osm2pgsql在github的地址如下:https://github.com/openstreetmap/osm2pgsqlpostgis (可选)——是一个空间数据库,它扩展自Postgresql对象关系型数据库,它添加了地理信息对象通过本地的SQL查询。因为在安装Postgresql是可以选择下载安装postgis所以它是可选的。单独下载地址:http://postgis.net/installGeoServer——是一种有java开发的地理信息发布服务工具,支持OGC协议,如:WMS、WFS和WCS。下载地址:http://geoserver.org/display/GEOS/Download 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.osm3. 期间可能会报一个错误(整了我两天郁闷死了) 使用我第一步推荐的文章有一个错误: 会照成一个错误(如下) 。 使用了器推荐的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 offthe stylefile or use osm2pgsql in hstore more by adding -k into thecommand.
相关文章推荐
- MySQL(基础篇)之MySQL(时间和日期函数)
- Oracle flashback
- oracle定义及使用数组
- MYSQL 操作集
- Oracle用一个表的列更新另一个表对应记录的列,一不小心有字段就更新为空了
- Ubuntu通过apt-get安装的MySQL卸载方案
- Mariadb-Host '192.168.*.*' is not allowed to connect to this MariaDB server"的解决方法
- 关于数据库容灾之数据容灾的总结
- ubuntu mysql中中文乱码问题
- sql update多表联合更新
- MySQL 可以用localhost 连接,但不能用IP连接的问题 (from:internet)
- SQL语句---nvl 用法
- Nutch 抓取数据到MySQL详细过…
- SQL Server查询性能调优、捕捉和评估查询性能
- MySQL安装时mysql write configuration file无响应问题的解决办法
- mysql最大字段数量及 varchar类型总结
- c#如何通过配置文件进行链接sql server数据库
- SQLServer查询实例名
- MySQL自定义排序函数FIELD()
- oracle-sql优化