4

I have installed QGIS 2.4.0 on Windows. I also downloaded an OSM file form Geofrabrik (SouthAmerica).

I have been searching an option (plugin also) in QGIS for importing the OSM file to my PostGIS with no results.

Is there an option in QGIS or will I have to do it another way? (maybe with osm2pgsql manually)

7

QGIS has several ways to import OSM data:

  • using Layer -> Add Layer -> Add vector layer
  • using Vector -> OpenStreetmap

Both create a spatialite database. You can take the layers of the spatialite database and export them to an empty Postgis database.

But using om2pgsql is the far better tool, because it can deal with large amounts of data far better than QGIS can.

By the way, current version of QGIS is 2.12.

|improve this answer|||||
  • Ok, thanks!. I will try with osm2pgsql.... – Pablo Garín Jan 8 '16 at 12:15
1

You can download shapefiles from geofabrik and import them in postgis.

|improve this answer|||||
  • 2
    Note that the free geofabrik shapefiles do not contain all OSM objects; see download.geofabrik.de/technical.html: "the shape files are not "complete" - we have made a selection of features and attributes. The shape files do not (yet) support multipolygon geometries, i.e. complex area features could be missing" – til_b Jan 8 '16 at 14:48
  • If we import OSM to qgis then also some data will be lost. Original OSM data is in postgres schema to handle complex geometries. importing into postgis will incur some loss. Shapefiles are good enough for general purpose. – neogeomat Jan 8 '16 at 14:55
  • 1
    @til_b - am I right in thinking that the protobuf files from geofabrik do include multipolygons? In which case, the .pbf would be the best choice if using osm2pgsql? – Steven Kay Jan 9 '16 at 22:32
  • 1
    I very much think the pbf files are complete, and should be used as a basis for importing using osm2pgsql. The guide at switch2osm.org/serving-tiles/… also mentions that you should use pbf country extracts from geofabrik. – til_b Jan 10 '16 at 12:00
1

OGR2OGR can import OSM to Postgis, and if you've installed QGIS, you can use it from the OSGeo4W shell that is installed with QGIS.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.