Import OSM file to PostGis on Windows10

谁说胖子不能爱 提交于 2019-12-02 02:13:33

I used OGR2OGR to import osm data in pbf format on Windows (Windows 10, Posgres 9.6 with Postgis 2.3). You can use OGR2OGR from the "OSgeo42 shell", which comes with QGIS or you can get Osgeo4w separately here). The steps are something like this:

  • Create a new database: create database db_for_osm
  • Create Postgis extension in your db. In SQL create extension postgis
  • Now you can run OGR2OGR. Open the "OSGEO4W shell". This will open a command window with all the environment variables set. The command will be something like ogr2ogr -f PostgreSQL PG:"dbname='db_for_osm' host='localhost' port='5432' user='myuser' password='mypassword'" planet.osm.pbf

My large upload took a couple of days to complete, so be prepared for this to take a long time - I suggest you do a test with a small region first - for the test I did for this answer I downloaded a city from Mapzen.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!