Pgadmin4建立数据库
建立数据库后,执行CREATE EXTENSION postgis
下载软件
windows平台(win10可用)
osm2pgsql下载地址:http://customdebug.com/osm/osm2pgsql.zip
最新版下载:https://ci.appveyor.com/project/openstreetmap/osm2pgsql
default.style文件:https://github.com/openstreetmap/osm2pgsql/blob/master/default.style
官方注释有详细说明,也可以根据需要制作style文件
处理default.style文件
把所有#的注释删除掉,要不然Error
reading style file line 1 (fields=1)
修改pg_hba.conf
注释:osm2pgsql 0.96.0版本 可以使用-W密码连接
osm2pgsql -d 数据库名 -U 用户名 -H localhost -W -P 5432 -S “D:\webGIS\osm2pgsql-bin\default.style” 文件名.pbf
这里必须修改,即使在命令里面输入用户名和密码还是会提示Error:
Connection to database failed: fe_sendauth: no password supplied错误