1、安装postgresql,安装postgis插件,创建数据库,添加postgis扩展。
2、从openstreetmap下载osm.pbf数据,也可从Geofabrik Download Server下载
3、下载osmosis工具,解压到本地,添加bin路径到环境变量
4、在数据库中创建对应表
psql -d postgis_32_sample -U postgres -W -f D:\program\osmosis-0.48.3\script\pgsimple_schema_0.6.sql
5、转换pbf文件为osm文件
osmosis --read-pbf "D:\worker\geocoder\data\beijing.osm.pbf" --write-xml beijing.osm
6、将osm文件导入到数据库
osmosis --read-xml file=D:\worker\geocoder\data\beijing.osm. --write-pgsimp database=”postgis_32_sample” user=”postgres” password=”1” host=”localhost”