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:
Is there any fast way to get the polygon into qgis?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
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:
Vector -> Openstreetmap -> Import Topology from XML
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.
Yet another way, this time using gdal:
curl -o Tatabányai_kistérség.osm http://www.openstreetmap.org/api/0.6/relation/1027806/full
ogr2ogr -f SQLite -dsco spatialite=yes Tatabányai_kistérség.sqlite Tatabányai_kistérség.osm --config OGR_SQLITE_SYNCHRONOUS OFF --config OSM_USE_CUSTOM_INDEXING NO
ogr2ogr -f GeoJSON -dsco spatialite=yes Tatabányai_kistérség.geojson Tatabányai_kistérség.sqlite -sql 'select * from multipolygons'
I chose GeoJSON as an output format as it can handle longer field names than a shape file. You might also want to modify your system's osmconf.ini if you need custom field mappings. This approach works with all of the data sets I've tried. It builds tidy polygons, and isn't troubled by ID issues like the old QGIS plugin.