[GIS] How to import polygons from OSM to QGIS

importopenstreetmappolygonqgisqgis-2

I am trying to import Polygons from OSM to QGIS 2.0, but so far I have no idea how to do that.
E. g.: Kisterseg auf Tatabanya in HU:
http://www.openstreetmap.org/?relation=1027806

Is there any fast way to get the polygon into qgis?

Best Answer

Unfortunately, the new OSM import in QGIS 2.0 does not support multipolygon relations from OSM in an easy way. So you have to use a workaround:

  • load the relation from OSM database:

http://www.openstreetmap.org/api/0.6/relation/1027806/full

  • load the data in JOSM
  • Join the different parts of the border line (for your case 45 lines) to a single one. JOSM does this better than QGIS.
  • Save as .osm file and DO NOT UPLOAD THE DATA TO THE OSM SERVER on exiting JOSM.
  • Open the OSM file in QGIS with Vector -> Openstreetmap -> Import Topology from XML
  • Save as spatialite database with Vector -> Openstreetmap -> Export to Spatialite

selecting the database you created in the step before, and polygons for output.

If you want all border polygons from a country, you might be quicker with a postgis database filled with osm2pgsql. This will create polygons from multipolygon and border relations automatically. You can then load the data into QGIS.

Related Question